Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Issue 2524673005: Prevent bad casting in ImageBitmap when calling ArrayBuffer::createOrNull (Closed)

Created:
4 years ago by xidachen
Modified:
4 years ago
Reviewers:
CC:
chromium-reviews
Target Ref:
refs/pending/branch-heads/2883
Project:
chromium
Visibility:
Public.

Description

Prevent bad casting in ImageBitmap when calling ArrayBuffer::createOrNull Currently when ImageBitmap's constructor is invoked, we check whether dstSize will overflow size_t or not. The problem comes when we call ArrayBuffer::createOrNull some times in the code. Both parameters of ArrayBuffer::createOrNull are unsigned. In ImageBitmap when we call this method, the first parameter is usually width * height. This could overflow unsigned even if it has been checked safe with size_t, the reason is that unsigned is a 32-bit value on 64-bit systems, while size_t is a 64-bit value. This CL makes a change such that we check whether the dstSize will overflow unsigned or not. In this case, we can guarantee that createOrNull will not have any crash. BUG=664139 Review-Url: https://codereview.chromium.org/2500493002 Cr-Commit-Position: refs/heads/master@{#431936} (cherry picked from commit d59a4441697f6253e7dc3f7ae5caad6e5fd2c778) Committed: https://chromium.googlesource.com/chromium/src/+/9c2617e82d77a72987eff9b241e407289a0536b6

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+48 lines, -42 lines) Patch
M third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-invalid-args.html View 3 chunks +14 lines, -10 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-invalid-args-expected.txt View 1 chunk +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/frame/ImageBitmap.cpp View 14 chunks +32 lines, -31 lines 0 comments Download

Messages

Total messages: 2 (1 generated)
xidachen
4 years ago (2016-11-23 02:07:33 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
9c2617e82d77a72987eff9b241e407289a0536b6.

Powered by Google App Engine
This is Rietveld 408576698