mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 15:32:53 +01:00
Allow for a non-initialized alpha decompressor in DoRemap.
BUG=oss-fuzz:9364 Change-Id: Ib1a1c6b0ccfcc255505f019e3e8fd15db73bc4b6
This commit is contained in:
parent
2563db4759
commit
da96d8d9ab
@ -140,10 +140,9 @@ static void DoRemap(WebPIDecoder* const idec, ptrdiff_t offset) {
|
|||||||
if (NeedCompressedAlpha(idec)) {
|
if (NeedCompressedAlpha(idec)) {
|
||||||
ALPHDecoder* const alph_dec = dec->alph_dec_;
|
ALPHDecoder* const alph_dec = dec->alph_dec_;
|
||||||
dec->alpha_data_ += offset;
|
dec->alpha_data_ += offset;
|
||||||
if (alph_dec != NULL) {
|
if (alph_dec != NULL && alph_dec->vp8l_dec_ != NULL) {
|
||||||
if (alph_dec->method_ == ALPHA_LOSSLESS_COMPRESSION) {
|
if (alph_dec->method_ == ALPHA_LOSSLESS_COMPRESSION) {
|
||||||
VP8LDecoder* const alph_vp8l_dec = alph_dec->vp8l_dec_;
|
VP8LDecoder* const alph_vp8l_dec = alph_dec->vp8l_dec_;
|
||||||
assert(alph_vp8l_dec != NULL);
|
|
||||||
assert(dec->alpha_data_size_ >= ALPHA_HEADER_LEN);
|
assert(dec->alpha_data_size_ >= ALPHA_HEADER_LEN);
|
||||||
VP8LBitReaderSetBuffer(&alph_vp8l_dec->br_,
|
VP8LBitReaderSetBuffer(&alph_vp8l_dec->br_,
|
||||||
dec->alpha_data_ + ALPHA_HEADER_LEN,
|
dec->alpha_data_ + ALPHA_HEADER_LEN,
|
||||||
|
@ -1576,7 +1576,6 @@ int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
|
|||||||
if (dec == NULL) return 0;
|
if (dec == NULL) return 0;
|
||||||
|
|
||||||
assert(alph_dec != NULL);
|
assert(alph_dec != NULL);
|
||||||
alph_dec->vp8l_dec_ = dec;
|
|
||||||
|
|
||||||
dec->width_ = alph_dec->width_;
|
dec->width_ = alph_dec->width_;
|
||||||
dec->height_ = alph_dec->height_;
|
dec->height_ = alph_dec->height_;
|
||||||
@ -1608,11 +1607,12 @@ int VP8LDecodeAlphaHeader(ALPHDecoder* const alph_dec,
|
|||||||
|
|
||||||
if (!ok) goto Err;
|
if (!ok) goto Err;
|
||||||
|
|
||||||
|
// Only set here, once we are sure it is valid (to avoid thread races).
|
||||||
|
alph_dec->vp8l_dec_ = dec;
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
Err:
|
Err:
|
||||||
VP8LDelete(alph_dec->vp8l_dec_);
|
VP8LDelete(dec);
|
||||||
alph_dec->vp8l_dec_ = NULL;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user