Descriptionfix for ubsan on unittest.h fastrand()
internal math of the fastrand function uses a multiply
and add that overflows a signed int. This triggers a
ubsan failure:
../../unit_test/../unit_test/unit_test.h:60:33: runtime error: signed integer overflow: 56248274 * 214013 cannot be represented in type 'int'
This change casts the intermediate math to unsigned
int to avoid the overflow.
For more info on ubsan, see
http://dev.chromium.org/developers/testing/undefinedbehaviorsanitizer
TESTED=Passing compilation using:
GYP_DEFINES="ubsan=1"
GYP_DEFINES="ubsan_vptr=1"
R=harryjin@google.com, pbos@webrtc.org
BUG=libyuv:563
Committed: https://chromium.googlesource.com/libyuv/libyuv/+/903c91cc2e3c831748d6f6168b7a8bb98f6ab9ec
Patch Set 1 #
Total comments: 2
Patch Set 2 : use unsigned int for seed #Patch Set 3 : fix lint warning: Weird number of spaces at line-start. #
Messages
Total messages: 8 (2 generated)
|