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

Side by Side Diff: printing/page_range_unittest.cc

Issue 25651002: Fixed memory overflow caused by invalid input. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « printing/page_range.cc ('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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/page_range.h" 5 #include "printing/page_range.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 TEST(PageRangeTest, RangeMerge) { 8 TEST(PageRangeTest, RangeMerge) {
9 printing::PageRanges ranges; 9 printing::PageRanges ranges;
10 printing::PageRange range; 10 printing::PageRange range;
(...skipping 14 matching lines...) Expand all
25 EXPECT_EQ(4, pages[3]); 25 EXPECT_EQ(4, pages[3]);
26 EXPECT_EQ(5, pages[4]); 26 EXPECT_EQ(5, pages[4]);
27 EXPECT_EQ(10, pages[5]); 27 EXPECT_EQ(10, pages[5]);
28 EXPECT_EQ(11, pages[6]); 28 EXPECT_EQ(11, pages[6]);
29 EXPECT_EQ(12, pages[7]); 29 EXPECT_EQ(12, pages[7]);
30 } 30 }
31 31
32 TEST(PageRangeTest, Empty) { 32 TEST(PageRangeTest, Empty) {
33 printing::PageRanges ranges; 33 printing::PageRanges ranges;
34 std::vector<int> pages(printing::PageRange::GetPages(ranges)); 34 std::vector<int> pages(printing::PageRange::GetPages(ranges));
35 EXPECT_EQ(0U, pages.size()); 35 EXPECT_TRUE(pages.empty());
36 } 36 }
37
38 TEST(PageRangeTest, Huge) {
39 printing::PageRanges ranges;
40 printing::PageRange range;
41 range.from = 1;
42 range.to = 2000000000;
43 ranges.push_back(range);
44 std::vector<int> pages(printing::PageRange::GetPages(ranges));
45 EXPECT_FALSE(pages.empty());
46 }
OLDNEW
« no previous file with comments | « printing/page_range.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698