]> git.sesse.net Git - ffmpeg/commitdiff
avformat/utils: Add av_assert1 to preclude NULL + len, len != 0
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 14 Feb 2021 22:55:39 +0000 (23:55 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 15 Feb 2021 15:50:55 +0000 (16:50 +0100)
Such a scenario is undefined behaviour and would also indicate a bug
in our code.

Suggested-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/utils.c

index cea6d4ca92d63657fcc4f39751eb479712abeaf9..652758e98e2fd13c560f0c4d3f12ef66265ade05 100644 (file)
@@ -1426,6 +1426,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
         pkt->pts = pkt->dts = AV_NOPTS_VALUE;
         pkt->pos = -1;
         /* increment read pointer */
+        av_assert1(data || !len);
         data  = len ? data + len : data;
         size -= len;