mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 21:28:22 +01:00
handle error cases more robustly
Change-Id: I252fd9596d10db26026b8c577ad7f29ffd373f4c
This commit is contained in:
parent
0e94935ca9
commit
b1c9e8b48c
10
src/vp8.c
10
src/vp8.c
@ -259,7 +259,12 @@ int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io) {
|
||||
}
|
||||
|
||||
br = &dec->br_;
|
||||
VP8Init(br, buf, buf_size);
|
||||
if (!VP8Init(br, buf, buf_size)) {
|
||||
return VP8SetError(dec, 2, "not enough data for bit reader");
|
||||
}
|
||||
if (frm_hdr->partition_length_ > buf_size) {
|
||||
return VP8SetError(dec, 2, "bad partition length");
|
||||
}
|
||||
buf += frm_hdr->partition_length_;
|
||||
buf_size -= frm_hdr->partition_length_;
|
||||
if (frm_hdr->key_frame_) {
|
||||
@ -391,6 +396,9 @@ static int GetCoeffs(VP8BitReader* const br, ProbaArray prob,
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (n == 16) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user