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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDataTest.cpp

Issue 2763613003: Fix signed integer overflow in ImageData (Closed)
Patch Set: Adding tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageData.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/html/ImageData.h"
6
7 #include "platform/geometry/IntSize.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace blink {
11 namespace {
12
13 class ImageDataTest : public ::testing::Test {
14 protected:
15 ImageDataTest(){};
16 void TearDown(){};
17 };
18
19 TEST_F(ImageDataTest, NegativeAndZeroIntSizeTest) {
20 ImageData* imageData;
21
22 imageData = ImageData::create(IntSize(0, 10));
23 EXPECT_EQ(imageData, nullptr);
24
25 imageData = ImageData::create(IntSize(10, 0));
26 EXPECT_EQ(imageData, nullptr);
27
28 imageData = ImageData::create(IntSize(0, 0));
29 EXPECT_EQ(imageData, nullptr);
30
31 imageData = ImageData::create(IntSize(-1, 10));
32 EXPECT_EQ(imageData, nullptr);
33
34 imageData = ImageData::create(IntSize(10, -1));
35 EXPECT_EQ(imageData, nullptr);
36
37 imageData = ImageData::create(IntSize(-1, -1));
Justin Novosad 2017/03/20 18:03:33 You forgot to cover large values that overflow int
zakerinasab 2017/03/20 20:50:33 Thanks for the hint. New test added.
38 EXPECT_EQ(imageData, nullptr);
39 }
40
41 } // namspace
42 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/ImageData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698