mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
idec: fix internal state corruption
A call to Append/Update would index the parts_ array w/-1 as num_parts_ had yet to be set by DecodePartition0. This would cause corruption within the VP8Decoder member. Fixes issue #106. Change-Id: Ib9f2811594ff19e948a66fda862a4e0a384bb9aa
This commit is contained in:
parent
01b6380656
commit
7bb6a9ccd6
@ -127,6 +127,7 @@ static int AppendToMemBuffer(WebPIDecoder* const idec,
|
||||
memcpy(mem->buf_ + mem->end_, data, data_size);
|
||||
mem->end_ += data_size;
|
||||
assert(mem->end_ <= mem->buf_size_);
|
||||
assert(last_part >= 0);
|
||||
dec->parts_[last_part].buf_end_ = mem->buf_ + mem->end_;
|
||||
|
||||
// note: setting up idec->io_ is only really needed at the beginning
|
||||
@ -155,6 +156,7 @@ static int RemapMemBuffer(WebPIDecoder* const idec,
|
||||
REMAP(dec->parts_[p].buf_end_, base, data);
|
||||
}
|
||||
}
|
||||
assert(last_part >= 0);
|
||||
dec->parts_[last_part].buf_end_ = data + data_size;
|
||||
|
||||
// Remap partition #0 data pointer to new offset.
|
||||
|
@ -47,6 +47,7 @@ VP8Decoder* VP8New(void) {
|
||||
SetOk(dec);
|
||||
WebPWorkerInit(&dec->worker_);
|
||||
dec->ready_ = 0;
|
||||
dec->num_parts_ = 1;
|
||||
}
|
||||
return dec;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user