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:
parent
9ea3d57fde
commit
ca95c19d27
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user