mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
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> (cherry picked from commit 5b82852519e92a2b94de0f22da1a81df5b3e0412) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
5d891ffbe5
commit
f466265169
@ -201,6 +201,8 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (p != (psets + strlen(pset_string))) {
|
if (p != (psets + strlen(pset_string))) {
|
||||||
|
if (p - psets >= MAX_PSET_SIZE)
|
||||||
|
goto fail_in_loop;
|
||||||
*p = ',';
|
*p = ',';
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -211,6 +213,7 @@ static int extradata2psets(AVFormatContext *s, const AVCodecParameters *par,
|
|||||||
if (!av_base64_encode(p, MAX_PSET_SIZE - (p - psets), r, r1 - r)) {
|
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",
|
av_log(s, AV_LOG_ERROR, "Cannot Base64-encode %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"!\n",
|
||||||
MAX_PSET_SIZE - (p - psets), r1 - r);
|
MAX_PSET_SIZE - (p - psets), r1 - r);
|
||||||
|
fail_in_loop:
|
||||||
av_free(psets);
|
av_free(psets);
|
||||||
av_free(tmpbuf);
|
av_free(tmpbuf);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user