1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-10 06:10:52 +02:00

avformat/ffmetadec: don't compare undefined string

Fixes use-of-uninitialized-value when bp.len == 0.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
This commit is contained in:
Kacper Michajłow
2025-07-26 04:55:12 +02:00
parent efeddd1b8b
commit 96ab006566

View File

@@ -182,7 +182,7 @@ static int read_header(AVFormatContext *s)
while(!avio_feof(s->pb)) {
get_bprint_line(s->pb, &bp);
if (!memcmp(bp.str, ID_STREAM, strlen(ID_STREAM))) {
if (bp.len == strlen(ID_STREAM) && !memcmp(bp.str, ID_STREAM, strlen(ID_STREAM))) {
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
@@ -192,7 +192,7 @@ static int read_header(AVFormatContext *s)
st->codecpar->codec_id = AV_CODEC_ID_FFMETADATA;
m = &st->metadata;
} else if (!memcmp(bp.str, ID_CHAPTER, strlen(ID_CHAPTER))) {
} else if (bp.len == strlen(ID_CHAPTER) && !memcmp(bp.str, ID_CHAPTER, strlen(ID_CHAPTER))) {
AVChapter *ch = read_chapter(s);
if (!ch)