[FFmpeg-devel] [PATCH 1/3] avformat/flac_picture: Simplify checks

Michael Niedermayer michael at niedermayer.cc
Sun Dec 1 17:13:23 EET 2019

On Fri, Nov 29, 2019 at 08:44:09PM +0100, Andreas Rheinhardt wrote:
> During parsing a flac picture metadata block, the mimetype is read as
> follows: Its 32b size field is read and checked for being in the range
> 1..63; afterwards, the actual mimetype-string is read into a buffer of
> size 64, where the length to read is the minimum of the length field and
> the size of the destination buffer -1. Then an assert guards that length
> is indeed < the size of the destination buffer before the string in the
> buffer is zero-terminated.
> The FFMIN as well as the assert are actually redundant, as it has
> been checked that the string (even after terminating) fits into the
> buffer. In order to make this clear, reword the check "len >= 64" to
> "len >= sizeof(mimetype)" and drop the FFMIN as well as the assert.
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  libavformat/flac_picture.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

will apply patchset


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Republics decline into democracies and democracies degenerate into
despotisms. -- Aristotle
-------------- 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/20191201/dfc52818/attachment.sig>

More information about the ffmpeg-devel mailing list