handle error cases more robustly

Change-Id: I252fd9596d10db26026b8c577ad7f29ffd373f4c
This commit is contained in:
Pascal Massimino 2010-12-20 05:26:08 -08:00
parent 0e94935ca9
commit b1c9e8b48c

View File

@ -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;
}