Instead of accessing unintialized data when input is shorter than expected size. Fixes use of uninitialized value in MSAN build. Found by OSS-Fuzz.
Unified · Split
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "libavutil/mem.h" |
| 31 | 31 | #include "libavformat/internal.h" |
| 32 | 32 | #include "avformat.h" |
| 33 | +#include "avio_internal.h" | |
| 33 | 34 | #include "demux.h" |
| 34 | 35 | |
| 35 | 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 | 244 | SCDDemuxContext *ctx = s->priv_data; |
| 244 | 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 | 248 | return ret; |
| 248 | 249 | |
| 249 | 250 | ctx->hdr.magic = AV_RB64(buf + 0); |