webrtc/modules/audio_processing/agc
Alex Loiko c531af77c3 Fix 'Left shift cannot be represented in int32_t'.
In the legacy C part of AGC, an audio level 'cur_level' is represented as

  (1+frac) * 2^(31 - zeros)

The 'zeros' exponent part is used for looking up a gain value in a
table, and 'frac' is used for interpolating between two nearby table
values. Code snippet below:

  zeros = WebRtcSpl_NormU32((uint32_t)cur_level);
  tmp32 = (cur_level << zeros) & 0x7FFFFFFF;
  frac = (int16_t)(tmp32 >> 19);

In the second line, 'cur_level' is shifted upwards so that the leading
bit is '1', after which the leading bit is cleared. The result is
'frac' in Q31.

The compiler type of 'cur_level << zeros' is 'int32_t'. This is a
fuzzer error 'Left shift cannot be represented in int32_t', 
because the leading sign bit is 1. This CL changes the compiler type to
uint32_t.

Bug: chromium:776286
Change-Id: Ie29552b75e690057bd76fc88e747841b531e3802
Reviewed-on: https://webrtc-review.googlesource.com/14841
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20405}
2017-10-24 09:56:08 +00:00
..
legacy Fix 'Left shift cannot be represented in int32_t'. 2017-10-24 09:56:08 +00:00
agc.cc Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
agc.h Adding NOLINT for typedefs.h and common_types.h 2017-09-15 13:03:51 +00:00
agc_manager_direct.cc Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
agc_manager_direct.h Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
agc_manager_direct_unittest.cc Reland "Reland "Remove WEBRTC_TRACE."" 2017-10-04 14:40:44 +00:00
gain_map_internal.h Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
loudness_histogram.cc Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
loudness_histogram.h Adding NOLINT for typedefs.h and common_types.h 2017-09-15 13:03:51 +00:00
loudness_histogram_unittest.cc Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
mock_agc.h Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
utility.cc Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00
utility.h Fixing WebRTC after moving from src/webrtc to src/ 2017-09-15 05:02:56 +00:00