[libav-bugs] [Bug 1000] New: Global Out of bounds read in decode_residual() #2

bugzilla at libav.org bugzilla at libav.org
Thu Dec 15 10:14:00 CET 2016


https://bugzilla.libav.org/show_bug.cgi?id=1000

            Bug ID: 1000
           Summary: Global Out of bounds read in decode_residual() #2
           Product: Libav
           Version: git HEAD
          Hardware: X86
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: ---
         Component: libavcodec
          Assignee: bugzilla at libav.org
          Reporter: fumfi.255 at gmail.com

Created attachment 627
  --> https://bugzilla.libav.org/attachment.cgi?id=627&action=edit
POC to trigger global out of bounds read (avconv)

After some fuzz testing I found a crashing test case.

Command: avconv -i libav_goobr_decode_residual -f /dev/null
Git Head: f22da2cdf90dc892d483e2d4003cffc0500816f6

ASAN:

==5291==ERROR: AddressSanitizer: global-buffer-overflow on address
0x00000258d61f at pc 0x000001c6129c bp 0x7ffef2718230 sp 0x7ffef2718228
READ of size 1 at 0x00000258d61f thread T0
    #0 0x1c6129b in decode_residual XYZ/libav/libavcodec/h264_cavlc.c:618:9
    #1 0x1c46eea in decode_luma_residual
XYZ/libav/libavcodec/h264_cavlc.c:679:29
    #2 0x1c46eea in ff_h264_decode_mb_cavlc
XYZ/libav/libavcodec/h264_cavlc.c:1121
    #3 0x1ce1cef in decode_slice XYZ/libav/libavcodec/h264_slice.c:2406:19
    #4 0x1cdf589 in ff_h264_execute_decode_slices
XYZ/libav/libavcodec/h264_slice.c:2503:15
    #5 0xc9e5f6 in decode_nal_units XYZ/libav/libavcodec/h264dec.c:588:27
    #6 0xc9e5f6 in h264_decode_frame XYZ/libav/libavcodec/h264dec.c:742
    #7 0xa9b549 in avcodec_decode_video2 XYZ/libav/libavcodec/decode.c:320:19
    #8 0xa9a46e in do_decode XYZ/libav/libavcodec/decode.c:168:15
    #9 0xa99612 in avcodec_send_packet XYZ/libav/libavcodec/decode.c:245:12
    #10 0x8dc07b in try_decode_frame XYZ/libav/libavformat/utils.c:1950:19
    #11 0x8d5bc3 in avformat_find_stream_info
XYZ/libav/libavformat/utils.c:2459:9
    #12 0x4f8701 in open_input_file XYZ/libav/avconv_opt.c:771:11
    #13 0x4f7394 in open_files XYZ/libav/avconv_opt.c:2408:15
    #14 0x4f6bd2 in avconv_parse_options XYZ/libav/avconv_opt.c:2445:11
    #15 0x51c0cf in main XYZ/libav/avconv.c:2876:11
    #16 0x7ff0a09f082f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #17 0x41af48 in _start (/usr/local/bin/avconv+0x41af48)

0x00000258d61f is located 1 bytes to the left of global variable
'ff_zigzag_scan' defined in 'libavcodec/mathtables.c:126:15' (0x258d620) of
size 16
0x00000258d61f is located 31 bytes to the right of global variable
'ff_zigzag_direct' defined in 'libavcodec/mathtables.c:115:15' (0x258d5c0) of
size 64
SUMMARY: AddressSanitizer: global-buffer-overflow
XYZ/libav/libavcodec/h264_cavlc.c:618:9 in decode_residual
Shadow bytes around the buggy address:
  0x0000804a9a70: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0000804a9a80: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0000804a9a90: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0000804a9aa0: f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9 f9
  0x0000804a9ab0: f9 f9 f9 f9 f9 f9 f9 f9 00 00 00 00 00 00 00 00
=>0x0000804a9ac0: f9 f9 f9[f9]00 00 f9 f9 f9 f9 f9 f9 00 00 00 00
  0x0000804a9ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0000804a9ae0: 00 00 00 00 00 00 00 00 05 f9 f9 f9 f9 f9 f9 f9
  0x0000804a9af0: 00 00 00 00 07 f9 f9 f9 f9 f9 f9 f9 00 00 05 f9
  0x0000804a9b00: f9 f9 f9 f9 00 00 00 f9 f9 f9 f9 f9 00 00 00 01
  0x0000804a9b10: f9 f9 f9 f9 00 00 04 f9 f9 f9 f9 f9 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==5291==ABORTING

Regards,
Kamil Frankowicz

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libav.org/pipermail/libav-bugs/attachments/20161215/2f209860/attachment.html>


More information about the libav-bugs mailing list