aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/sdp.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-05-08 04:07:40 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-06-07 21:42:25 +0200
commit5b82852519e92a2b94de0f22da1a81df5b3e0412 (patch)
tree87174dcd35be97af6c46e3f78b7d072492df4263 /libavformat/sdp.c
parenta3d3a580263df01d69977d1b6042c0f71965b168 (diff)
downloadffmpeg-5b82852519e92a2b94de0f22da1a81df5b3e0412.tar.gz
avformat/sdp: Check before appending ","
Found by reviewing code related to CID1500301 String not null terminated Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/sdp.c')
-rw-r--r--libavformat/sdp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 7e11a75918..ccfaa8aff5 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -203,6 +203,8 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
continue;
}
if (p != (psets + strlen(pset_string))) {
+ if (p - psets >= MAX_PSET_SIZE)
+ goto fail_in_loop;
*p = ',';
p++;
}
@@ -213,6 +215,7 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n",
MAX_PSET_SIZE - (p - psets), r1 - r);
+fail_in_loop:
av_free(psets);
av_free(tmpbuf);