mirror of
https://github.com/webmproject/libwebp.git
synced 2025-06-27 14:44:35 +02:00
Merge "VP8BitReaderSetBuffer: move NULL check to call site" into main
This commit is contained in:
commit
23ce76fa37
@ -141,9 +141,15 @@ static void DoRemap(WebPIDecoder* const idec, ptrdiff_t offset) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
const uint8_t* const last_start = dec->parts[last_part].buf;
|
const uint8_t* const last_start = dec->parts[last_part].buf;
|
||||||
|
// 'last_start' will be NULL when 'idec->state' is < STATE_VP8_PARTS0
|
||||||
|
// and through a portion of that state (when there isn't enough data to
|
||||||
|
// parse the partitions). The bitreader is only used meaningfully when
|
||||||
|
// there is enough data to begin parsing partition 0.
|
||||||
|
if (last_start != NULL) {
|
||||||
VP8BitReaderSetBuffer(&dec->parts[last_part], last_start,
|
VP8BitReaderSetBuffer(&dec->parts[last_part], last_start,
|
||||||
mem->buf + mem->end - last_start);
|
mem->buf + mem->end - last_start);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
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;
|
||||||
|
@ -31,13 +31,12 @@
|
|||||||
void VP8BitReaderSetBuffer(VP8BitReader* const br,
|
void VP8BitReaderSetBuffer(VP8BitReader* const br,
|
||||||
const uint8_t* const start,
|
const uint8_t* const start,
|
||||||
size_t size) {
|
size_t size) {
|
||||||
if (start != NULL) {
|
assert(start != NULL);
|
||||||
br->buf = start;
|
br->buf = start;
|
||||||
br->buf_end = start + size;
|
br->buf_end = start + size;
|
||||||
br->buf_max =
|
br->buf_max =
|
||||||
(size >= sizeof(lbit_t)) ? start + size - sizeof(lbit_t) + 1 : start;
|
(size >= sizeof(lbit_t)) ? start + size - sizeof(lbit_t) + 1 : start;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void VP8InitBitReader(VP8BitReader* const br,
|
void VP8InitBitReader(VP8BitReader* const br,
|
||||||
const uint8_t* const start, size_t size) {
|
const uint8_t* const start, size_t size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user