|
|
Created:
4 years, 5 months ago by xidachen Modified:
4 years, 5 months ago Reviewers:
Justin Novosad CC:
chromium-reviews, dshwang, ajuma+watch-canvas_chromium.org, blink-reviews-html_chromium.org, dglazkov+blink, Rik, blink-reviews Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionFix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer
Right now in this method, it does a size.width() * size.height(), and
that could cause integer overflow.
This CL fix that by using CheckedNumeric<int>.
BUG=630024
Committed: https://crrev.com/29622ffb0f2116f242bcddb38aec7a9100dda7ea
Cr-Commit-Position: refs/heads/master@{#406914}
Patch Set 1 #Patch Set 2 : use CheckedNumeric #Messages
Total messages: 20 (13 generated)
xidachen@chromium.org changed reviewers: + junov@chromium.org
PTAL
On 2016/07/21 13:47:03, xidachen wrote: > PTAL Prefer this: #include "base/numerics/safe_math.h" (...) CheckedNumeric<int> area = size.width(); area *= size.height(); if (!area.IsValid() || area.ValueOrDie() > MaxCanvasArea) return false;
On 2016/07/21 15:35:58, Justin Novosad wrote: > On 2016/07/21 13:47:03, xidachen wrote: > > PTAL > Prefer this: > > > #include "base/numerics/safe_math.h" > > (...) > > CheckedNumeric<int> area = size.width(); > area *= size.height(); > if (!area.IsValid() || area.ValueOrDie() > MaxCanvasArea) > return false; Good point. We are not allowed to include src/base/ directly from WebKit, but we already have a wtf::CheckedNumeric in this file, so that works.
lgtm
The CQ bit was checked by xidachen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer Right now in this method, it does a size.width() * size.height(), and that could cause integer overflow. This CL fix that by moving size.height() to the other side of the inequality. BUG=630024 ========== to ========== Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer Right now in this method, it does a size.width() * size.height(), and that could cause integer overflow. This CL fix that by using CheckedNumeric<int>. BUG=630024 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_...)
The CQ bit was checked by xidachen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by xidachen@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer Right now in this method, it does a size.width() * size.height(), and that could cause integer overflow. This CL fix that by using CheckedNumeric<int>. BUG=630024 ========== to ========== Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer Right now in this method, it does a size.width() * size.height(), and that could cause integer overflow. This CL fix that by using CheckedNumeric<int>. BUG=630024 ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001)
Message was sent while issue was closed.
Description was changed from ========== Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer Right now in this method, it does a size.width() * size.height(), and that could cause integer overflow. This CL fix that by using CheckedNumeric<int>. BUG=630024 ========== to ========== Fix integer over flow issue in HTMLCanvasElement::canCreateImageBuffer Right now in this method, it does a size.width() * size.height(), and that could cause integer overflow. This CL fix that by using CheckedNumeric<int>. BUG=630024 Committed: https://crrev.com/29622ffb0f2116f242bcddb38aec7a9100dda7ea Cr-Commit-Position: refs/heads/master@{#406914} ==========
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/29622ffb0f2116f242bcddb38aec7a9100dda7ea Cr-Commit-Position: refs/heads/master@{#406914} |