[FFmpeg-devel] [PATCH 1/2] fftools/ffmpeg_opt: Check attachment filesize

Michael Niedermayer michael at niedermayer.cc
Fri Apr 17 01:39:49 EEST 2020


On Wed, Apr 15, 2020 at 11:06:13PM +0200, Andreas Rheinhardt wrote:
> 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.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  fftools/ffmpeg_opt.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

LGTM

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200417/ca227ef8/attachment.sig>


More information about the ffmpeg-devel mailing list