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

Unified Diff: webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c

Issue 1734883003: iSAC entropy coder: Avoid signed integer overflow (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/ubsan/blacklist.txt ('k') | webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c
index 2379ba50661f2bac040ab2044ddc38a80be8b18a..c9ddf935801090e5959df3ee45bf38334011a4be 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c
@@ -392,13 +392,13 @@ static void GenerateDitherQ7(int16_t *bufQ7,
seed = WEBRTC_SPL_UMUL(seed, 196314165) + 907633515;
/* fixed-point dither sample between -64 and 64 (Q7) */
- dither1_Q7 = (int16_t)(((int32_t)seed + 16777216) >> 25);
+ dither1_Q7 = (int16_t)(((int32_t)(seed + 16777216)) >> 25);
/* new random unsigned int32_t */
seed = WEBRTC_SPL_UMUL(seed, 196314165) + 907633515;
/* fixed-point dither sample between -64 and 64 */
- dither2_Q7 = (int16_t)((seed + 16777216) >> 25);
+ dither2_Q7 = (int16_t)(((int32_t)(seed + 16777216)) >> 25);
kwiberg-webrtc 2016/02/25 11:57:00 Here, I'm actually changing the behavior. The old
tlegrand-webrtc 2016/02/26 10:21:40 I think this changes should be fine.
shft = (int16_t)(WEBRTC_SPL_RSHIFT_U32(seed, 25) & 15);
if (shft < 5)
@@ -432,7 +432,7 @@ static void GenerateDitherQ7(int16_t *bufQ7,
seed = WEBRTC_SPL_UMUL(seed, 196314165) + 907633515;
/* fixed-point dither sample between -64 and 64 */
- dither1_Q7 = (int16_t)(((int32_t)seed + 16777216) >> 25);
+ dither1_Q7 = (int16_t)(((int32_t)(seed + 16777216)) >> 25);
/* dither sample is placed in either even or odd index */
shft = (int16_t)(WEBRTC_SPL_RSHIFT_U32(seed, 25) & 1); /* either 0 or 1 */
« no previous file with comments | « tools/ubsan/blacklist.txt ('k') | webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698