diff --git a/src/dec/idec.c b/src/dec/idec.c index fdce8839..e7733333 100644 --- a/src/dec/idec.c +++ b/src/dec/idec.c @@ -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. diff --git a/src/dec/vp8.c b/src/dec/vp8.c index 8f3889c5..b37d87d5 100644 --- a/src/dec/vp8.c +++ b/src/dec/vp8.c @@ -47,6 +47,7 @@ VP8Decoder* VP8New(void) { SetOk(dec); WebPWorkerInit(&dec->worker_); dec->ready_ = 0; + dec->num_parts_ = 1; } return dec; }