gosec icon indicating copy to clipboard operation
gosec copied to clipboard

Add detection of overflow during integer conversion

Open findmyhappy opened this issue 1 year ago • 1 comments

Summary

G109 provides detection of overflow during strconv.Atoi, but there seems to be no good way to detect the more common conversions between integers, such as uint32 to int32.

Steps to reproduce the behavior

gosec version

Go version (output of 'go version')

Operating system / Environment

Expected behavior

Actual behavior

findmyhappy avatar Apr 25 '24 03:04 findmyhappy

This is a good addition. I was also thinking about a rule to detect this conversions which can lead to overflows.

ccojocar avatar May 02 '24 08:05 ccojocar