loosen the padding check on buffer size

Strictly speaking, the last (or first) row doesn't require padding.

cf https://code.google.com/p/webp/issues/detail?id=258

(cherry picked from commit 15ca5014f1)

Change-Id: Ie9ec8eb776fec1f5cea4cf9e21e81901fd79bf33
This commit is contained in:
Pascal Massimino 2015-09-08 23:54:32 -07:00 committed by James Zern
parent 53d22c5b3e
commit d089362d07

View File

@ -67,7 +67,9 @@ static VP8StatusCode CheckDecBuffer(const WebPDecBuffer* const buffer) {
} else { // RGB checks
const WebPRGBABuffer* const buf = &buffer->u.RGBA;
const int stride = abs(buf->stride);
const uint64_t size = (uint64_t)stride * height;
// strictly speaking, the very last (or first, if flipped) row
// doesn't require padding.
const uint64_t size = (uint64_t)stride * (height - 1) + width;
ok &= (size <= buf->size);
ok &= (stride >= width * kModeBpp[mode]);
ok &= (buf->rgba != NULL);