From 515aa63e4dd76a96022df04b07823b568c5fef65 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 14 Feb 2021 23:55:39 +0100 Subject: [PATCH] avformat/utils: Add av_assert1 to preclude NULL + len, len != 0 Such a scenario is undefined behaviour and would also indicate a bug in our code. Suggested-by: James Almer Reviewed-by: James Almer Signed-off-by: Andreas Rheinhardt (cherry picked from commit da857099e92fb7fede6d7b9e6b26879ce9c5a483) --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index c78af468d4..7e5767ec60 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1472,6 +1472,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;