]> git.sesse.net Git - ffmpeg/commitdiff
avformat/sdp: Fix potential write beyond end of buffer
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 7 Jul 2020 19:50:33 +0000 (21:50 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 10 Jul 2020 18:36:31 +0000 (20:36 +0200)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/sdp.c

index 34e9839b67aa20993132ee6237710b8a02411a5d..2ce1a62262defbd965e0720ab9283ba56b533fa3 100644 (file)
@@ -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);