Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8324 closed defect (fixed)

signed integer overflow at libavfilter/vf_premultiply.c:212

Reported by: Suhwan Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: premultiply ubsan
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I compiled ffmpeg with "--toolchain=clang-usan" to check the undefined-behaviours and attached log file.
How to reproduce:

% ffmpeg_g -t 1 -y -i $PoC1 -i $PoC2 -filter_complex premultiply -target vcd -loglevel 0 tmp.hnm

ffmpeg version N-95517-g0b8956b25c Copyright (c) 2000-2019 the FFmpeg developers
built with clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
configuration: --cc=clang --cxx=clang++ --ld=clang --enable-debug --toolchain=clang-usan

Here's UBSAN log

libavfilter/vf_premultiply.c:212:44: runtime error: signed integer overflow: 61187 * 37008 cannot be represented in type 'int'
[Switching to Thread 0x7fffdf7ee700 (LWP 1202)]

Thread 37 "ffmpeg_g" hit Breakpoint 1, 0x00000000004288b0 in __ubsan::ScopedReport::~ScopedReport() ()
(gdb) bt
#0  0x00000000004288b0 in __ubsan::ScopedReport::~ScopedReport() ()
#1  0x000000000042b0eb in void handleIntegerOverflowImpl<__ubsan::Value>(__ubsan::OverflowData*, unsigned long, char const*, __ubsan::Value, __ubsan::ReportOptions) ()
#2  0x000000000042c9df in __ubsan_handle_mul_overflow ()
#3  0x0000000000cdaf16 in premultiply16offset (mmsrc=<optimized out>, aasrc=<optimized out>, 
    ddst=<optimized out>, mlinesize=<optimized out>, alinesize=<optimized out>, dlinesize=<optimized out>, 
    w=60, h=1, half=32768, shift=16, offset=4096) at libavfilter/vf_premultiply.c:212
#4  0x0000000000cdd599 in premultiply_slice (ctx=<optimized out>, arg=<optimized out>, jobnr=<optimized out>, 
    nb_jobs=<optimized out>) at libavfilter/vf_premultiply.c:390
#5  0x00000000006635d5 in worker_func (priv=0x93cd600, jobnr=12, threadnr=<optimized out>, 
    nb_jobs=<optimized out>, nb_threads=<optimized out>) at libavfilter/pthread.c:50
#6  0x00000000059e73e8 in run_jobs (ctx=0x93d0300) at libavutil/slicethread.c:61
#7  0x00000000059e61f6 in thread_worker (v=<optimized out>) at libavutil/slicethread.c:85
#8  0x00007ffff668e6db in start_thread (arg=0x7fffdf7ee700) at pthread_create.c:463
#9  0x00007ffff5d9388f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) q

Please confirm.
Thanks

Attachments (2)

PoC_1.sct (3.1 KB ) - added by Suhwan 4 years ago.
poc1
PoC_2.png48 (12.5 KB ) - added by Suhwan 4 years ago.
poc2

Download all attachments as: .zip

Change History (4)

by Suhwan, 4 years ago

Attachment: PoC_1.sct added

poc1

by Suhwan, 4 years ago

Attachment: PoC_2.png48 added

poc2

comment:1 by Elon Musk, 4 years ago

Resolution: fixed
Status: newclosed

comment:2 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavfilter
Keywords: premultiply added
Note: See TracTickets for help on using tickets.