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

Unified Diff: core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp

Issue 2358023002: Check for overflow in CMap_GetCode. (Closed)
Patch Set: Review fixes Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp
index ccf49ee46a3d290b1789d52943a721cfbcf072a1..ec05df5226f767551cac7ae66f6405075dbf9cdd 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid_unittest.cpp
@@ -28,6 +28,11 @@ TEST(fpdf_font_cid, CMap_GetCode) {
EXPECT_EQ(12u, CPDF_CMapParser::CMap_GetCode("12"));
EXPECT_EQ(12u, CPDF_CMapParser::CMap_GetCode("12d"));
EXPECT_EQ(128u, CPDF_CMapParser::CMap_GetCode("128"));
+
+ EXPECT_EQ(4294967295u, CPDF_CMapParser::CMap_GetCode("<FFFFFFFF"));
+
+ // Overflow a uint32_t.
+ EXPECT_EQ(0u, CPDF_CMapParser::CMap_GetCode("<100000000"));
}
TEST(fpdf_font_cid, CMap_GetCodeRange) {
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698