add byte length check to uint32

pull/2114/head
jennifersp 2024-08-23 16:17:07 -07:00
parent b197994b1f
commit 73bbced270
1 changed files with 4 additions and 0 deletions

View File

@ -296,6 +296,10 @@ func (scanPlanBinaryUint32ToTextScanner) Scan(src []byte, dst any) error {
return s.ScanText(Text{})
}
if len(src) != 4 {
return fmt.Errorf("invalid length for uint32: %v", len(src))
}
n := uint64(binary.BigEndian.Uint32(src))
return s.ScanText(Text{String: strconv.FormatUint(n, 10), Valid: true})
}