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 | #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); |