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

Side by Side Diff: webrtc/modules/audio_coding/codecs/isac/main/source/arith_routines_hist.c

Issue 1979973003: Fix UBSan errors (left shift of negative value, left shift overflows int) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: variable name Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 stream_ptr = streamdata->stream + streamdata->stream_index; 208 stream_ptr = streamdata->stream + streamdata->stream_index;
209 W_upper = streamdata->W_upper; 209 W_upper = streamdata->W_upper;
210 if (W_upper == 0) 210 if (W_upper == 0)
211 /* Should not be possible in normal operation */ 211 /* Should not be possible in normal operation */
212 return -2; 212 return -2;
213 213
214 if (streamdata->stream_index == 0) /* first time decoder is called for this stream */ 214 if (streamdata->stream_index == 0) /* first time decoder is called for this stream */
215 { 215 {
216 /* read first word from bytestream */ 216 /* read first word from bytestream */
217 streamval = *stream_ptr << 24; 217 streamval = (uint32_t)(*stream_ptr) << 24;
218 streamval |= *++stream_ptr << 16; 218 streamval |= (uint32_t)(*++stream_ptr) << 16;
219 streamval |= *++stream_ptr << 8; 219 streamval |= (uint32_t)(*++stream_ptr) << 8;
220 streamval |= *++stream_ptr; 220 streamval |= (uint32_t)(*++stream_ptr);
221 } else { 221 } else {
222 streamval = streamdata->streamval; 222 streamval = streamdata->streamval;
223 } 223 }
224 224
225 225
226 for (k=N; k>0; k--) 226 for (k=N; k>0; k--)
227 { 227 {
228 /* find the integer *data for which streamval lies in [W_lower+1, W_upper] * / 228 /* find the integer *data for which streamval lies in [W_lower+1, W_upper] * /
229 W_upper_LSB = W_upper & 0x0000FFFF; 229 W_upper_LSB = W_upper & 0x0000FFFF;
230 W_upper_MSB = W_upper >> 16; 230 W_upper_MSB = W_upper >> 16;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 streamdata->W_upper = W_upper; 282 streamdata->W_upper = W_upper;
283 streamdata->streamval = streamval; 283 streamdata->streamval = streamval;
284 284
285 285
286 /* find number of bytes in original stream (determined by current interval wid th) */ 286 /* find number of bytes in original stream (determined by current interval wid th) */
287 if ( W_upper > 0x01FFFFFF ) 287 if ( W_upper > 0x01FFFFFF )
288 return streamdata->stream_index - 2; 288 return streamdata->stream_index - 2;
289 else 289 else
290 return streamdata->stream_index - 1; 290 return streamdata->stream_index - 1;
291 } 291 }
OLDNEW
« no previous file with comments | « no previous file | 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