In Golang you can fuzz your code in 32bit mode on amd64 machines. You do this by...
Tom Sellers @TomSellers@infosec.exchange
In Golang you can fuzz your code in 32bit mode on amd64 machines. You do this by prepending GOARCH=386 to your go test call, just like you'd set GOARCH for any other task.
The reason might want to do this is that certain variable types, such as int are smaller on 32bit platforms. For example, on 32bit platforms int is generally int32 (-2147483648 to 2147483647) and on 64 bit platforms int is int64 (-9223372036854775808 to 9223372036854775807).
This matters because you are more likely to overflow an int32 value than an int64. For folks parsing untrusted data which specifies field length you could end up reading a large "field length" value that, when combined with some offset overflows the value of int. The resulting value would pass a check like if offset+fieldLen < len(data) due to being negative or just smaller than offset but still be invalid in the context of the data.
Fuzzing in 32bit mode makes it much easier to trigger these errors.
A caveat, fuzzing with GOARCH=386 will be slower because there is no coverage guidance for the fuzzer on this arch.
Note that you can't do 32 bit fuzzing on Apple Silicon machines since there is only one GOARCH for them which is arm64. I tend to do my fuzzing on Intel based machine running Linux.