From d359b750afcca74524a1d686d2413c41b21d8486 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Tue, 7 Jul 2020 21:50:33 +0200 Subject: [PATCH] avformat/sdp: Fix potential write beyond end of buffer Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Rheinhardt (cherry picked from commit 5d91b7718efc581da8882a4e9bf2f5953e41adbf) Signed-off-by: Andreas Rheinhardt --- libavformat/sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/sdp.c b/libavformat/sdp.c index 34e9839b67..2ce1a62262 100644 --- a/libavformat/sdp.c +++ b/libavformat/sdp.c @@ -212,7 +212,7 @@ static char *extradata2psets(AVFormatContext *s, AVCodecParameters *par) p += strlen(p); r = r1; } - if (sps && sps_end - sps >= 4) { + if (sps && sps_end - sps >= 4 && p - psets <= MAX_PSET_SIZE - strlen(profile_string) - 7) { memcpy(p, profile_string, strlen(profile_string)); p += strlen(p); ff_data_to_hex(p, sps + 1, 3, 0);