[libav-bugs] [Bug 998] New: Heap out of bounds read in pred8x16_dc_8_c()

bugzilla at libav.org bugzilla at libav.org
Thu Dec 8 13:04:51 CET 2016


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

            Bug ID: 998
           Summary: Heap out of bounds read in pred8x16_dc_8_c()
           Product: Libav
           Version: git HEAD
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: ---
         Component: libavcodec
          Assignee: bugzilla at libav.org
          Reporter: fumfi.255 at gmail.com

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

After some fuzz testing I found a crashing test case.

Command: avconv -i libav_hoobr_pred8x16_dc_8_c -f /dev/null

Git Head: f22da2cdf90dc892d483e2d4003cffc0500816f6

Output + ASAN:

avconv version v13_dev0-588-gf22da2c, Copyright (c) 2000-2016 the Libav
developers
  built on Dec  7 2016 11:40:38 with clang version 3.9.0
(tags/RELEASE_390/final)
Trailing options were found on the commandline.
=================================================================
==19539==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x62f00008c288 at pc 0x000001d592bb bp 0x7ffd604cf4c0 sp 0x7ffd604cf4b8
READ of size 1 at 0x62f00008c288 thread T0
    #0 0x1d592ba in pred8x16_dc_8_c
XYZ/libav/libavcodec/h264pred_template.c:683:34
    #1 0x1d5ae61 in pred8x16_mad_cow_dc_0lt_8
XYZ/libav/libavcodec/h264pred_template.c:736:5
    #2 0x1c7fb2a in hl_decode_mb_complex
XYZ/libav/libavcodec/h264_mb_template.c:162:17
    #3 0x1c6bfbe in ff_h264_hl_decode_mb XYZ/libav/libavcodec/h264_mb.c:806:9
    #4 0x1ce0f2a in decode_slice XYZ/libav/libavcodec/h264_slice.c:2342:17
    #5 0x1cdf589 in ff_h264_execute_decode_slices
XYZ/libav/libavcodec/h264_slice.c:2503:15
    #6 0xc9e5f6 in decode_nal_units XYZ/libav/libavcodec/h264dec.c:588:27
    #7 0xc9e5f6 in h264_decode_frame XYZ/libav/libavcodec/h264dec.c:742
    #8 0xa9b549 in avcodec_decode_video2 XYZ/libav/libavcodec/decode.c:320:19
    #9 0xa9a46e in do_decode XYZ/libav/libavcodec/decode.c:168:15
    #10 0xa99612 in avcodec_send_packet XYZ/libav/libavcodec/decode.c:245:12
    #11 0x8dc07b in try_decode_frame XYZ/libav/libavformat/utils.c:1950:19
    #12 0x8d5bc3 in avformat_find_stream_info
XYZ/libav/libavformat/utils.c:2459:9
    #13 0x4f8701 in open_input_file XYZ/libav/avconv_opt.c:771:11
    #14 0x4f7394 in open_files XYZ/libav/avconv_opt.c:2408:15
    #15 0x4f6bd2 in avconv_parse_options XYZ/libav/avconv_opt.c:2445:11
    #16 0x51c0cf in main XYZ/libav/avconv.c:2876:11
    #17 0x7fc6caf1482f in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #18 0x41af48 in _start (/usr/local/bin/avconv+0x41af48)

0x62f00008c288 is located 376 bytes to the left of 55696-byte region
[0x62f00008c400,0x62f000099d90)
allocated by thread T0 here:
    #0 0x4ba207 in __interceptor_posix_memalign
/home/development/llvm/3.9.0/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:130:3
    #1 0x239b3f5 in av_malloc XYZ/libav/libavutil/mem.c:71:9
    #2 0x23671aa in av_buffer_alloc XYZ/libav/libavutil/buffer.c:72:12
    #3 0x2369657 in pool_alloc_buffer XYZ/libav/libavutil/buffer.c:290:26
    #4 0x2369657 in av_buffer_pool_get XYZ/libav/libavutil/buffer.c:326
    #5 0xa9f2ef in video_get_buffer XYZ/libav/libavcodec/decode.c:698:23
    #6 0xa9f2ef in avcodec_default_get_buffer2
XYZ/libav/libavcodec/decode.c:732
    #7 0xaa2065 in ff_get_buffer XYZ/libav/libavcodec/decode.c:867:11

SUMMARY: AddressSanitizer: heap-buffer-overflow
XYZ/libav/libavcodec/h264pred_template.c:683:34 in pred8x16_dc_8_c
Shadow bytes around the buggy address:
  0x0c5e80009800: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009810: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009820: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009830: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009840: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c5e80009850: fa[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009860: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009870: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c5e80009880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c5e80009890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c5e800098a0: 00 00 00 00 00 00 00 00 00 00 00 00 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
==19539==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/20161208/6b7b2be8/attachment.html>


More information about the libav-bugs mailing list