History

libavformat/amr.c: Check return value from avio_read()

If the buffer doesn't contain enough bytes when reading a stream, fail rather than continuing on with initialized data. Caught by Chromium fuzzeras (crbug.com/1065731).

John Rummell committed 6 years ago

Commit 5b967f51 parent 4700f7d1 file · +4 −2Browse files

Unified · Split

libavformat/amr.c+4−2
@@ -89,13 +89,15 @@ static int amr_read_header(AVFormatContext *s) · 88 unmodified lines
8989 AVStream *st;
9090 uint8_t header[9];
9191
92− avio_read(pb, header, 6);
92+ if (avio_read(pb, header, 6) != 6)
93+ return AVERROR_INVALIDDATA;
9394
9495 st = avformat_new_stream(s, NULL);
9596 if (!st)
9697 return AVERROR(ENOMEM);
9798 if (memcmp(header, AMR_header, 6)) {
98− avio_read(pb, header + 6, 3);
99+ if (avio_read(pb, header + 6, 3) != 3)
100+ return AVERROR_INVALIDDATA;
99101 if (memcmp(header, AMRWB_header, 9)) {
100102 return -1;
101103 }

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