Commit f8a869ea authored by Leon Scroggins III's avatar Leon Scroggins III Committed by Commit Bot

APNG: Check for overflow in ParseFrameInfo

Bug: 993266

When checking to ensure that the frame rect fits inside the canvas,
check for overflow.

Change-Id: I70c7c6a2b0f2700c0446c23ba6c9fb44a22577d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1752126
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686582}
parent a4db41dc
...@@ -688,8 +688,18 @@ bool PNGImageReader::ParseFrameInfo(const png_byte* data) { ...@@ -688,8 +688,18 @@ bool PNGImageReader::ParseFrameInfo(const png_byte* data) {
return false; return false;
if (!frame_width || !frame_height) if (!frame_width || !frame_height)
return false; return false;
if (x_offset + frame_width > width_ || y_offset + frame_height > height_) {
return false; png_uint_32 frame_right;
if (!base::CheckAdd(x_offset, frame_width).AssignIfValid(&frame_right) ||
frame_right > width_)
return false;
}
{
png_uint_32 frame_bottom;
if (!base::CheckAdd(y_offset, frame_height).AssignIfValid(&frame_bottom) ||
frame_bottom > height_)
return false;
}
new_frame_.frame_rect = new_frame_.frame_rect =
IntRect(x_offset, y_offset, frame_width, frame_height); IntRect(x_offset, y_offset, frame_width, frame_height);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment