Adding validation before using an SkImageInfo object read from an SkReadBuffer.

BUG=389574
R=senorblanco@google.com, reed@google.com, senorblanco@chromium.org

Author: sugoi@chromium.org

Review URL: https://codereview.chromium.org/376803004
This commit is contained in:
sugoi 2014-07-08 09:18:48 -07:00 committed by Commit bot
parent 9ea3d57fde
commit ca95c19d27

View File

@ -1201,6 +1201,11 @@ bool SkBitmap::ReadRawPixels(SkReadBuffer* buffer, SkBitmap* bitmap) {
SkImageInfo info;
info.unflatten(*buffer);
// If there was an error reading "info", don't use it to compute minRowBytes()
if (!buffer->validate(true)) {
return false;
}
const size_t ramRB = info.minRowBytes();
const int height = info.height();
const size_t snugSize = snugRB * height;