Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Issue 1662453003: fix for ubsan on unittest.h fastrand() (Closed)

Created:
4 years, 10 months ago by fbarchard1
Modified:
4 years, 10 months ago
Reviewers:
harryjin, pbos-webrtc
Base URL:
https://chromium.googlesource.com/libyuv/libyuv@master
Target Ref:
refs/heads/master
Project:
libyuv
Visibility:
Public.

Description

fix 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. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -11 lines) Patch
M README.chromium View 1 1 chunk +1 line, -1 line 0 comments Download
M include/libyuv/version.h View 1 1 chunk +1 line, -1 line 0 comments Download
M unit_test/unit_test.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M unit_test/unit_test.cc View 1 2 6 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 8 (2 generated)
fbarchard1
4 years, 10 months ago (2016-02-02 20:21:26 UTC) #1
fbarchard1
GYP_DEFINES=ubsan=1 gclient runhooks ninja -v -C out/Release out/Release/libyuv_unittest
4 years, 10 months ago (2016-02-02 20:28:18 UTC) #3
pbos-webrtc
https://codereview.chromium.org/1662453003/diff/1/unit_test/unit_test.h File unit_test/unit_test.h (right): https://codereview.chromium.org/1662453003/diff/1/unit_test/unit_test.h#newcode58 unit_test/unit_test.h:58: extern int fastrand_seed; Just use an unsigned int, then ...
4 years, 10 months ago (2016-02-02 21:11:47 UTC) #4
harryjin
lgtm
4 years, 10 months ago (2016-02-02 21:39:51 UTC) #5
fbarchard1
added version number https://codereview.chromium.org/1662453003/diff/1/unit_test/unit_test.h File unit_test/unit_test.h (right): https://codereview.chromium.org/1662453003/diff/1/unit_test/unit_test.h#newcode58 unit_test/unit_test.h:58: extern int fastrand_seed; On 2016/02/02 21:11:47, ...
4 years, 10 months ago (2016-02-02 22:23:33 UTC) #6
fbarchard1
4 years, 10 months ago (2016-02-02 22:32:16 UTC) #8
Message was sent while issue was closed.
Committed patchset #3 (id:40001) manually as
903c91cc2e3c831748d6f6168b7a8bb98f6ab9ec (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698