Opened 5 years ago

Closed 5 years ago

#7666 closed defect (fixed)

Signed integer overflow when converting to ya16

Reported by: Carl Eugen Hoyos Owned by:
Priority: important Component: swscale
Version: git-master Keywords: ubsan
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

$ make tests/vsynth1/00.pgm
$ ffmpeg -vcodec pgmyuv -i tests/vsynth1/%02d.pgm -pix_fmt ya16le -f null -
ffmpeg version N-92942-g02b6d1d Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 6.4.0 (GCC)
  configuration: --enable-gpl --toolchain=gcc-usan
  libavutil      56. 25.100 / 56. 25.100
  libavcodec     58. 43.100 / 58. 43.100
  libavformat    58. 25.100 / 58. 25.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 47.100 /  7. 47.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, image2, from 'tests/vsynth1/%02d.pgm':
  Duration: 00:00:02.00, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: pgmyuv, yuv420p, 352x288, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (pgmyuv (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
libswscale/output.c:920:15: runtime error: signed integer overflow: 2147311616 + 262144 cannot be represented in type 'int'
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf58.25.100
    Stream #0:0: Video: wrapped_avframe, ya16le, 352x288, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.43.100 wrapped_avframe
frame=   50 fps=0.0 q=-0.0 Lsize=N/A time=00:00:02.00 bitrate=N/A speed=28.2x
video:26kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Tested on x86_64, same error with --enable-ftrapv

Change History (1)

comment:1 by Elon Musk, 5 years ago

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