summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/amr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/amr.c b/libavformat/amr.c
index eccbbde5b0..b8a5debb16 100644
--- a/libavformat/amr.c
+++ b/libavformat/amr.c
@@ -89,13 +89,15 @@ static int amr_read_header(AVFormatContext *s)
AVStream *st;
uint8_t header[9];
- avio_read(pb, header, 6);
+ if (avio_read(pb, header, 6) != 6)
+ return AVERROR_INVALIDDATA;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
if (memcmp(header, AMR_header, 6)) {
- avio_read(pb, header + 6, 3);
+ if (avio_read(pb, header + 6, 3) != 3)
+ return AVERROR_INVALIDDATA;
if (memcmp(header, AMRWB_header, 9)) {
return -1;
}