This code:
const maxByte = 255
asRunes := []rune(malformed)
final := make([]byte, len(asRunes))
for i, r := range asRunes {
if r > maxByte {
continue
}
final[i] = byte(r) // <-- FALSE POSITIVE? G115 here
}
produces a false positive on the marked line, I think.
Just above it, we skip that line if r > maxByte, and maxByte is const 255. So, it should never overflow right?
This code:
produces a false positive on the marked line, I think.
Just above it, we skip that line
if r > maxByte, and maxByte isconst 255. So, it should never overflow right?