]> git.sesse.net Git - ffmpeg/commit
fftools/ffmpeg_opt: Check attachment filesize
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 15 Apr 2020 18:54:42 +0000 (20:54 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 16 Apr 2020 23:34:07 +0000 (01:34 +0200)
commit889ad93c8839e5ac1ec28bc8e1fea6df71b9bf80
tree3934ce8e367bf57669fee788beee92f66258fc41
parentd1e52e396b8aa778bd8d12bf25864beca0937d0a
fftools/ffmpeg_opt: Check attachment filesize

The data of an attachment file is put into an AVCodecParameter's
extradata. The corresponding size field has type int, yet there was no
check for the size to fit into an int. As a consequence, it was possible
to create extradata with negative size (by using a big enough max_alloc).

Other errors were also possible: If SIZE_MAX < INT64_MAX (e.g. on 32bit
systems) then the file size might be truncated before the allocation;
and avio_read() takes an int, too, so one would not have read as much
as one desired.

Furthermore, the extradata is now padded as is required.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
fftools/ffmpeg_opt.c