DescriptionFix an UBSan error (signed overflow) in saturating addition and subtraction
Of course, functions called WebRtcSpl_AddSatW32 and WebRtcSpl_SubSatW32 are supposed to handle overflow gracefully, and they probably did. But since the overflow handling depended on undefined behavior, a sufficiently smart optimizing compiler would have realized that it could just ignore the possibility of overflow and omit all the overflow handling code, leaving only the unadorned addition or subtraction.
Also, the new implementations, unlike the old ones, result in branch-free code (tested with clang 3.9 with -O2).
BUG=chromium:601728
Committed: https://crrev.com/bca568bfc59f944335510762f47fe4414ea1273e
Cr-Commit-Position: refs/heads/master@{#12846}
Patch Set 1 : #
Total comments: 8
Patch Set 2 : review suggestions #
Messages
Total messages: 17 (9 generated)
|