mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +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).
(cherry picked from commit e0a9932161
)
Change-Id: Ibac9fcfc4bd0a2c5f624bb9d4a2b9f6459aa19ea
This commit is contained in:
parent
3ab0a377d2
commit
3740f7d4c6
@ -529,6 +529,12 @@ static VP8StatusCode DecodeVP8LData(WebPIDecoder* const idec) {
|
||||
}
|
||||
|
||||
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_);
|
||||
}
|
||||
|
||||
|
@ -1357,6 +1357,10 @@ int VP8LDecodeImage(VP8LDecoder* const dec) {
|
||||
// Sanity checks.
|
||||
if (dec == NULL) return 0;
|
||||
|
||||
dec->status_ = VP8_STATUS_BITSTREAM_ERROR;
|
||||
assert(dec->hdr_.htree_groups_ != NULL);
|
||||
assert(dec->hdr_.num_htree_groups_ > 0);
|
||||
|
||||
io = dec->io_;
|
||||
assert(io != NULL);
|
||||
params = (WebPDecParams*)io->opaque;
|
||||
|
Loading…
Reference in New Issue
Block a user