[FFmpeg-cvslog] avformat/sdp: Fix potential write beyond end of buffer

Andreas Rheinhardt git at videolan.org
Fri Jul 10 22:54:46 EEST 2020


ffmpeg | branch: release/4.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Jul  7 21:50:33 2020 +0200| [d359b750afcca74524a1d686d2413c41b21d8486] | committer: Andreas Rheinhardt

avformat/sdp: Fix potential write beyond end of buffer

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
(cherry picked from commit 5d91b7718efc581da8882a4e9bf2f5953e41adbf)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d359b750afcca74524a1d686d2413c41b21d8486
---

 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);



More information about the ffmpeg-cvslog mailing list