New issue
Advanced search Search tips

Issue 776286 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Undefined-shift in WebRtcSpl_DownsampleBy2

Project Member Reported by ClusterFuzz, Oct 19 2017

Issue description

Detailed report: https://clusterfuzz.com/testcase?key=6076242897141760

Fuzzer: libFuzzer_audio_processing_fuzzer
Job Type: libfuzzer_chrome_ubsan
Platform Id: linux

Crash Type: Undefined-shift
Crash Address: 
Crash State:
  WebRtcSpl_DownsampleBy2
  WebRtcAgc_ProcessVad
  WebRtcAgc_ProcessDigital
  
Sanitizer: undefined (UBSAN)

Regressed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_ubsan&range=509903:509934

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=6076242897141760

Issue filed automatically.

See https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/reproducing.md for more information.
 
Cc: kkaluri@chromium.org
Components: Infra>Git Blink>WebRTC
Labels: M-64 Test-Predator-Wrong
Owner: mbonadei@chromium.org
Predator and CL could not provide any possible suspects.
Using the code search for the file, “resample_by_2.c”&"digital_agc.c" assigning to concern owner for recent work on these files


mbonadei@ -- Could you please look into this issue, kindly reassign if it has nothing to do with your changes.
Thank You.
Status: Assigned (was: Untriaged)
Cc: mbonadei@chromium.org
Owner: hlundin@chromium.org
I looked into it but it seems unrelated to CLs listed in https://webrtc.googlesource.com/src/+log/033ea5f77140eef0c2defd4bd668de5dac9af3ea..8a958528b2caa663de0b571e40fd62d34d503340?pretty=fuller&n=10000.

Assigning to hlundin@ for further investigation.
Cc: hlundin@chromium.org
Owner: aleloi@chromium.org
Project Member

Comment 5 by bugdroid1@chromium.org, Oct 24 2017

The following revision refers to this bug:
  https://webrtc.googlesource.com/src.git/+/c531af77c3e02332047fcaea2eccec945fdfbab5

commit c531af77c3e02332047fcaea2eccec945fdfbab5
Author: Alex Loiko <aleloi@webrtc.org>
Date: Tue Oct 24 09:56:08 2017

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}
[modify] https://crrev.com/c531af77c3e02332047fcaea2eccec945fdfbab5/modules/audio_processing/agc/legacy/digital_agc.c

Comment 6 by mmoroz@chromium.org, Oct 24 2017

For more information, please see https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/reference.md.

The link referenced in the description is no longer valid.
Project Member

Comment 7 by bugdroid1@chromium.org, Oct 25 2017

The following revision refers to this bug:
  https://webrtc.googlesource.com/src.git/+/b9f536167c951558cce8ab18a5012e0822d18855

commit b9f536167c951558cce8ab18a5012e0822d18855
Author: Alex Loiko <aleloi@webrtc.org>
Date: Wed Oct 25 13:35:36 2017

Removing undefined left shifts in AudioProcessing

This CL replaces 5 left shifts where the shifted value may be 
negative. The shifts are replaced with equivalent multiplications.

Bug:  chromium:777231 ,  chromium:776719 ,  chromium:776624 ,  chromium:776286 
Change-Id: Ifb27d5506eac779e60f238432bdf9e4bc5b2da4c
Reviewed-on: https://webrtc-review.googlesource.com/14800
Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20430}
[modify] https://crrev.com/b9f536167c951558cce8ab18a5012e0822d18855/common_audio/signal_processing/resample_by_2.c
[modify] https://crrev.com/b9f536167c951558cce8ab18a5012e0822d18855/common_audio/vad/vad_filterbank.c
[modify] https://crrev.com/b9f536167c951558cce8ab18a5012e0822d18855/modules/audio_processing/agc/legacy/digital_agc.c

Project Member

Comment 8 by ClusterFuzz, Oct 26 2017

ClusterFuzz has detected this issue as fixed in range 511516:511546.

Detailed report: https://clusterfuzz.com/testcase?key=6076242897141760

Fuzzer: libFuzzer_audio_processing_fuzzer
Job Type: libfuzzer_chrome_ubsan
Platform Id: linux

Crash Type: Undefined-shift
Crash Address: 
Crash State:
  WebRtcSpl_DownsampleBy2
  WebRtcAgc_ProcessVad
  WebRtcAgc_ProcessDigital
  
Sanitizer: undefined (UBSAN)

Regressed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_ubsan&range=509903:509934
Fixed: https://clusterfuzz.com/revisions?job=libfuzzer_chrome_ubsan&range=511516:511546

Reproducer Testcase: https://clusterfuzz.com/download?testcase_id=6076242897141760

See https://chromium.googlesource.com/chromium/src/+/master/testing/libfuzzer/reference.md for more information.

If you suspect that the result above is incorrect, try re-doing that job on the test case report page.
Project Member

Comment 9 by ClusterFuzz, Oct 26 2017

Labels: ClusterFuzz-Verified
Status: Verified (was: Assigned)
ClusterFuzz testcase 6076242897141760 is verified as fixed, so closing issue as verified.

If this is incorrect, please add ClusterFuzz-Wrong label and re-open the issue.

Sign in to add a comment