Opened 2 years ago

Closed 6 weeks ago

#8011 closed defect (fixed)

Division by zero at aacpsy.c:336

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

Description

Summary of the bug:
There's a division by zero at aacpsy.c:336.

How to reproduce:

% ffmpeg_g -y -r 75 -i tmp.wmv -map 0 -c:v:116 adpcm_yamaha -c:v zmbv -disposition:s:6 mp2fixed -disposition:s wmv2 -r 1 -ab 26 -ar 22050 -ac 16 -level 3 tmp_.mov

ffmpeg version N-94251-gf83b46e218 Copyright (c) 2000-2019 the FFmpeg developers
built with clang version 9.0.0

Attachments (2)

gdb_log_8011 (7.1 KB ) - added by Suhwan 2 years ago.
tmp.wmv (444.8 KB ) - added by Suhwan 2 years ago.

Download all attachments as: .zip

Change History (6)

by Suhwan, 2 years ago

Attachment: gdb_log_8011 added

by Suhwan, 2 years ago

Attachment: tmp.wmv added

comment:1 by Suhwan, 2 years ago

Is it impossible to trigger the bugs that I've reported?

comment:2 by Suhwan, 2 years ago

FFmpeg Version: 4.2
Many division by zero bugs are triggered.

ffmpeg version N-94906-gcb8d6a4e3e 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
  libavutil      56. 35.100 / 56. 35.100
  libavcodec     58. 56.101 / 58. 56.101
  libavformat    58. 32.104 / 58. 32.104
  libavdevice    58.  9.100 / 58.  9.100
  libavfilter     7. 58.102 /  7. 58.102
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, asf, from 'tmp.wmv':
  Metadata:
    encoder         : Lavf57.66.105
  Duration: 00:00:05.63, start: 0.000000, bitrate: 647 kb/s
    Stream #0:0: Video: wmv2 (WMV2 / 0x32564D57), yuv420p, 560x320, SAR 1:1 DAR 7:4, 30 fps, 30 tbr, 1k tbn, 1k tbc
    Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, mono, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (wmv2 (native) -> zmbv (native))
  Stream #0:1 -> #0:1 (wmav2 (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0xad97640] Bitrate 26 is extremely low, maybe you mean 26k
[aac @ 0xad97640] Using a PCE to encode channel layout "hexadecagonal"
libavcodec/aacpsy.c:336:69: runtime error: division by zero
The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s
[mov @ 0xad87400] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to 'tmp_.mov':
  Metadata:
    encoder         : Lavf58.32.104
    Stream #0:0: Video: zmbv, bgr0, 560x320 [SAR 1:1 DAR 7:4], q=2-31, 200 kb/s, 1 fps, 16384 tbn, 1 tbc
    Metadata:
      encoder         : Lavc58.56.101 zmbv
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, hexadecagonal, fltp, 0 kb/s
    Metadata:
      encoder         : Lavc58.56.101 aac
libavcodec/aacpsy.c:516:60: runtime error: division by zero
libavcodec/aacpsy.c:529:12: runtime error: -nan is outside the range of representable values of type 'int'
libavcodec/aaccoder.c:554:56: runtime error: division by zeroitrate=   0.3kbits/s speed=1.42x    
libavcodec/aaccoder.c:556:48: runtime error: division by zero
frame=    3 fps=2.2 q=-0.0 size=     256kB time=00:00:02.20 bitrate= 952.8kbits/s dup=0 drop=65 speed=1.63x  frame=    4 fps=2.1 q=-0.0 size=     512kB time=00:00:04.70 bitrate= 890.7kbits/s dup=0 drop=139 speed=2.43x [mov @ 0xad87400] not writing 'chan' tag due to lack of channel information
frame=    4 fps=2.0 q=-0.0 Lsize=     653kB time=00:00:05.61 bitrate= 951.4kbits/s dup=0 drop=162 speed=2.78x    
video:645kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.342332%
[aac @ 0xad97640] Qavg: 0.000
Last edited 2 years ago by Suhwan (previous) (diff)

comment:4 by Elon Musk, 6 weeks ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.