History

avformat/scd: ensure SCD_MIN_HEADER_SIZE bytes are read

Instead of accessing unintialized data when input is shorter than expected size. Fixes use of uninitialized value in MSAN build. Found by OSS-Fuzz.

Kacper Michajłow committed 1 year ago

Commit 3334bdc1 parent 1787fad1 file · +2 −1Browse files

Unified · Split

libavformat/scd.c+2−1
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #include "libavutil/mem.h"
3131 #include "libavformat/internal.h"
3232 #include "avformat.h"
33+#include "avio_internal.h"
3334 #include "demux.h"
3435
3536 #define SCD_MAGIC ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
@@ -243,7 +244,7 @@ static int scd_read_header(AVFormatContext *s) · 207 unmodified lines
243244 SCDDemuxContext *ctx = s->priv_data;
244245 uint8_t buf[SCD_MIN_HEADER_SIZE];
245246
246− if ((ret = avio_read(s->pb, buf, SCD_MIN_HEADER_SIZE)) < 0)
247+ if ((ret = ffio_read_size(s->pb, buf, SCD_MIN_HEADER_SIZE)) < 0)
247248 return ret;
248249
249250 ctx->hdr.magic = AV_RB64(buf + 0);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t