New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 773673 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 777555



Sign in to add a comment

Integer-overflow in av_frame_apply_cropping

Project Member Reported by ClusterFuzz, Oct 11 2017

Issue description

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

Fuzzer: ochang_search_index_mutator
Job Type: linux_ubsan_chrome
Platform Id: linux

Crash Type: Integer-overflow
Crash Address: 
Crash State:
  av_frame_apply_cropping
  apply_cropping
  avcodec_receive_frame
  
Sanitizer: undefined (UBSAN)

Regressed: https://clusterfuzz.com/revisions?job=linux_ubsan_chrome&range=507837:507876

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

Issue filed automatically.

See https://github.com/google/clusterfuzz-tools for more information.
 
Cc: kkaluri@chromium.org an...@khirnov.net
Components: Internals>Media>FFmpeg
Labels: M-63 CF-NeedsTriage Test-Predator-Correct-CLs
Predator has provided the two possible suspects for this issue

Suspect CL : https://chromium.googlesource.com/chromium/third_party/ffmpeg/+/019ab88a95cb31b698506d90e8ce56695a7f1cc5

Unable to find the author in the owners list, hence CC'ing author

anton@-- Could you please look into the issue, kindly re-assign if this is not related to your changes.



Owner: chcunningham@chromium.org
Status: Assigned (was: Untriaged)
kkaluri@ please take care not to cc folks outside the Chromium project, please just assign to the media label first to avoid spamming external owners unnecessarily -- they aren't able to access ClusterFuzz. 

Anton, if you do take a look the trace is:

../../third_party/ffmpeg/libavutil/frame.c:868:44: runtime error: signed integer overflow: 5 + 2147483647 cannot be represented in type 'int'
 #0 0x7f4088a673ab in av_frame_apply_cropping third_party/ffmpeg/libavutil/frame.c:868:44
 #1 0x7f40889ba2d1 in apply_cropping third_party/ffmpeg/libavcodec/decode.c:709:12
 #2 0x7f40889ba2d1 in avcodec_receive_frame third_party/ffmpeg/libavcodec/decode.c:736
#3 0x7f40889ba712 in compat_decode third_party/ffmpeg/libavcodec/decode.c:781:15

Comment 3 by an...@khirnov.net, Oct 12 2017

Hi,
Quoting dalecur… via monorail (2017-10-12 18:12:05)

From a brief look at the code I don't see how it can happen, since
1) the data and the linesize must be aligned to 32
2) if any offset is not aligned to 32, then left cropping must be non-zero
3) if left cropping is non-zero, then log2_crop_align is smaller than
   sizeof(int)*8, so no overflow can happen

Are you sure the data and linesize is properly aligned?
Here's the minimized test case if you want to try a local repro. I haven't gone through the code yet.
clusterfuzz-testcase-minimized-6019102954225664.ogg
658 KB Download
Blocking: 777555
Cc: sande...@chromium.org
Owner: dalecur...@chromium.org
Will see if I can get this in the M64 roll, otherwise will transfer to Dan.
Blocking: 771995
@anton: Indeed our linesize was not aligned to 32. I've changed that and it resolves the issue. Thanks.
Blocking: -771995
Fix in CQ, so tagging only with M64 roll.
Project Member

Comment 9 by bugdroid1@chromium.org, Nov 30 2017

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

commit a648b776f80a5039f7a78558b3acfb68975071dc
Author: Dale Curtis <dalecurtis@chromium.org>
Date: Thu Nov 30 22:49:04 2017

Increase VideoFrame stride alignment to 32; required by ffmpeg.

Per code inspection and commentary from ffmpeg developers, we
need to be using a stride that is aligned to 32 for software
video frames.

It seems at somepoint we might be able to use av_cpu_max_align(),
but even ffmpeg doesn't follow this internally and has exceptions
for when H264 content is used, so just leave a TODO for now.

BUG= 773673 
TEST=no more ubsan failure.

Change-Id: I012bf7ca5531559df63061fc1edc9fdeaebf4c08
Reviewed-on: https://chromium-review.googlesource.com/801775
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520727}
[modify] https://crrev.com/a648b776f80a5039f7a78558b3acfb68975071dc/media/base/video_frame.cc
[modify] https://crrev.com/a648b776f80a5039f7a78558b3acfb68975071dc/media/base/video_frame.h

Status: Fixed (was: Assigned)
Project Member

Comment 11 by ClusterFuzz, Dec 1 2017

ClusterFuzz has detected this issue as fixed in range 520688:520730.

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

Fuzzer: ochang_search_index_mutator
Job Type: linux_ubsan_chrome
Platform Id: linux

Crash Type: Integer-overflow
Crash Address: 
Crash State:
  av_frame_apply_cropping
  apply_cropping
  avcodec_receive_frame
  
Sanitizer: undefined (UBSAN)

Regressed: https://clusterfuzz.com/revisions?job=linux_ubsan_chrome&range=507837:507876
Fixed: https://clusterfuzz.com/revisions?job=linux_ubsan_chrome&range=520688:520730

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

See https://github.com/google/clusterfuzz-tools 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 12 by ClusterFuzz, Dec 1 2017

Labels: ClusterFuzz-Verified
Status: Verified (was: Fixed)
ClusterFuzz testcase 6019102954225664 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