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
30#include "libavutil/mem.h"30#include "libavutil/mem.h"
31#include "libavformat/internal.h"31#include "libavformat/internal.h"
32#include "avformat.h"32#include "avformat.h"
33#include "avio_internal.h"
33#include "demux.h"34#include "demux.h"
34 35
35#define SCD_MAGIC ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \36#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
243 SCDDemuxContext *ctx = s->priv_data;244 SCDDemuxContext *ctx = s->priv_data;
244 uint8_t buf[SCD_MIN_HEADER_SIZE];245 uint8_t buf[SCD_MIN_HEADER_SIZE];
245 246
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)
247 return ret;248 return ret;
248 249
249 ctx->hdr.magic = AV_RB64(buf + 0);250 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