mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
Rectify bug in lossless incremental decoding.
Handle the corner case when VP8LDecodeImage() method is called with an invalid header data. The lossless decoding doesn't support incremental mode yet. Return the error status as BITSTREAM error in case not all pixels are decoded with the provided bit-stream. Also added asserts in the VP8LDecodeImage() method to validate the decoder header with appropriate/valid data for huffman trees (htree_groups_ etc). Change-Id: Ibac9fcfc4bd0a2c5f624bb9d4a2b9f6459aa19ea
This commit is contained in:
parent
e2502a97c1
commit
e0a9932161
@ -527,6 +527,12 @@ static VP8StatusCode DecodeVP8LData(WebPIDecoder* const idec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!VP8LDecodeImage(dec)) {
|
if (!VP8LDecodeImage(dec)) {
|
||||||
|
// The decoding is called after all the data-bytes are aggregated. Change
|
||||||
|
// the error to VP8_BITSTREAM_ERROR in case lossless decoder fails to decode
|
||||||
|
// all the pixels (VP8_STATUS_SUSPENDED).
|
||||||
|
if (dec->status_ == VP8_STATUS_SUSPENDED) {
|
||||||
|
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
||||||
|
}
|
||||||
return ErrorStatusLossless(idec, dec->status_);
|
return ErrorStatusLossless(idec, dec->status_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,6 +1486,11 @@ int VP8LDecodeImage(VP8LDecoder* const dec) {
|
|||||||
// Sanity checks.
|
// Sanity checks.
|
||||||
if (dec == NULL) return 0;
|
if (dec == NULL) return 0;
|
||||||
|
|
||||||
|
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
||||||
|
assert(dec->hdr_.huffman_tables_ != NULL);
|
||||||
|
assert(dec->hdr_.htree_groups_ != NULL);
|
||||||
|
assert(dec->hdr_.num_htree_groups_ > 0);
|
||||||
|
|
||||||
io = dec->io_;
|
io = dec->io_;
|
||||||
assert(io != NULL);
|
assert(io != NULL);
|
||||||
params = (WebPDecParams*)io->opaque;
|
params = (WebPDecParams*)io->opaque;
|
||||||
|
Loading…
Reference in New Issue
Block a user