Opened 3 years ago
Closed 3 years ago
#10747 closed defect (fixed)
heap-buffer-overflow at libavfilter/af_stereotools.c:278:26 in FFmpeg
| Reported by: | ZengYunxiang | Owned by: | |
|---|---|---|---|
| Priority: | important | Component: | avfilter |
| Version: | git-master | Keywords: | bugs |
| Cc: | ZengYunxiang | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
Dear developers,
We found the following heap-buffer-overflow bug on FFmpeg(version N-113007-g8d24a28d06) when using stereotools filter, please confirm.
The poc file(poc14ffmpeg) will be attached to this ticket.
How to reproduce:
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg cd ffmpeg ./configure --cc=clang --cxx=clang++ --ld=clang --enable-debug --toolchain=clang-asan make -j30 ./ffmpeg_g -y -i poc14ffmpeg -filter_complex stereotools tmp.mp4
ASAN Log:
=================================================================
==3559237==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x609000007d80 at pc 0x559746351af5 bp 0x7f1c993fc170 sp 0x7f1c993fc168
WRITE of size 8 at 0x609000007d80 thread T2 (fc0)
#0 0x559746351af4 in filter_frame /ffmpeg/libavfilter/af_stereotools.c:278:26
#1 0x559745b79ed2 in ff_filter_frame_framed /ffmpeg/libavfilter/avfilter.c:969:11
#2 0x559745b79ed2 in ff_filter_frame_to_filter /ffmpeg/libavfilter/avfilter.c:1123:11
#3 0x559745b79ed2 in ff_filter_activate_default /ffmpeg/libavfilter/avfilter.c:1182:20
#4 0x559745b79ed2 in ff_filter_activate /ffmpeg/libavfilter/avfilter.c:1341:11
#5 0x559745b8bf57 in push_frame /ffmpeg/libavfilter/buffersrc.c:168:15
#6 0x559745b8bf57 in av_buffersrc_add_frame_flags /ffmpeg/libavfilter/buffersrc.c:272:15
#7 0x559745a79d3b in send_frame /ffmpeg/fftools/ffmpeg_filter.c:2668:11
#8 0x559745a79d3b in filter_thread /ffmpeg/fftools/ffmpeg_filter.c:2808:19
#9 0x559745abbc18 in task_wrapper /ffmpeg/fftools/ffmpeg_sched.c:2200:21
#10 0x7f1c9bea7ac2 (/lib/x86_64-linux-gnu/libc.so.6+0x94ac2) (BuildId: a43bfc8428df6623cd498c9c0caeb91aec9be4f9)
#11 0x7f1c9bf39a3f (/lib/x86_64-linux-gnu/libc.so.6+0x126a3f) (BuildId: a43bfc8428df6623cd498c9c0caeb91aec9be4f9)
0x609000007d81 is located 0 bytes to the right of 1-byte region [0x609000007d80,0x609000007d81)
allocated by thread T2 (fc0) here:
#0 0x559745a1f697 in __interceptor_posix_memalign (/ffmpeg/ffmpeg_g+0x924697) (BuildId: 8d6ccf457a75d047d11f9627d0b67208c2215c8c)
#1 0x559749088830 in av_malloc /ffmpeg/libavutil/mem.c:105:9
#2 0x559749088830 in av_malloc /ffmpeg/libavutil/mem.c:144:14
#3 0x559749088830 in av_mallocz /ffmpeg/libavutil/mem.c:256:17
#4 0x559749088830 in av_calloc /ffmpeg/libavutil/mem.c:267:12
#5 0x559746351ca5 in config_input /ffmpeg/libavfilter/af_stereotools.c:124:21
Thread T2 (fc0) created by T0 here:
#0 0x559745a07f9c in __interceptor_pthread_create (/ffmpeg/ffmpeg_g+0x90cf9c) (BuildId: 8d6ccf457a75d047d11f9627d0b67208c2215c8c)
#1 0x559745ab6161 in task_start /ffmpeg/fftools/ffmpeg_sched.c:403:11
#2 0x559745ad4e68 in transcode /ffmpeg/fftools/ffmpeg.c:922:11
#3 0x559745ad4e68 in main /ffmpeg/fftools/ffmpeg.c:1050:11
#4 0x7f1c9be3cd8f (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f) (BuildId: a43bfc8428df6623cd498c9c0caeb91aec9be4f9)
SUMMARY: AddressSanitizer: heap-buffer-overflow /ffmpeg/libavfilter/af_stereotools.c:278:26 in filter_frame
Shadow bytes around the buggy address:
0x0c127fff8f60: fa fa fa fa fa fa fa fa 00 fa fa fa fa fa fa fa
0x0c127fff8f70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c127fff8f80: 04 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c127fff8f90: 00 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c127fff8fa0: 04 fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c127fff8fb0:[01]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c127fff8fc0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 fa fa
0x0c127fff8fd0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 fa fa
0x0c127fff8fe0: fa fa fa fa fa fa fa fa 00 fa fa fa fa fa fa fa
0x0c127fff8ff0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 fa fa
0x0c127fff9000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
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
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
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
==3559237==ABORTING
ffmpeg version:
# ./ffmpeg -version ffmpeg version N-113007-g8d24a28d06 Copyright (c) 2000-2023 the FFmpeg developers built with Ubuntu clang version 14.0.0-1ubuntu1.1 configuration: --cc=clang --cxx=clang++ --ld=clang --enable-debug --toolchain=clang-asan libavutil 58. 34.100 / 58. 34.100 libavcodec 60. 35.100 / 60. 35.100 libavformat 60. 18.100 / 60. 18.100 libavdevice 60. 4.100 / 60. 4.100 libavfilter 9. 14.100 / 9. 14.100 libswscale 7. 6.100 / 7. 6.100 libswresample 4. 13.100 / 4. 13.100
Credit:
Discovered by Zeng Yunxiang and Song Jiaxuan.
Thanks for your time!
Attachments (1)
Change History (2)
by , 3 years ago
| Attachment: | poc14ffmpeg added |
|---|
comment:1 by , 3 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.



POC file