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

Change-Id: Ie9ec8eb776fec1f5cea4cf9e21e81901fd79bf33
This commit is contained in:
Pascal Massimino 2015-09-08 23:54:32 -07:00
parent d623a8706f
commit 15ca5014f1

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);