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

Unified Diff: core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp

Issue 656463006: Fix off-by-one in sizing of m_EmbeddedToUnicodes. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: g_Charset explicitly sized. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_font/font_int.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 2cee90c24a1b128fb3646c63a544f58fd4bc68c7..e5dabc33dab595debb0569c38228be42172b02e9 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -76,18 +76,15 @@ CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_B
pCMap->LoadPredefined(this, pname, bPromptCJK);
return pCMap;
}
-const FX_LPCSTR g_CharsetNames[] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS", NULL};
-const int g_CharsetCPs[] = {0, 936, 950, 932, 949, 1200, 0};
+static const FX_LPCSTR g_CharsetNames[NUMBER_OF_CIDSETS] = {NULL, "GB1", "CNS1", "Japan1", "Korea1", "UCS" };
+static const int g_CharsetCPs[NUMBER_OF_CIDSETS] = {0, 936, 950, 932, 949, 1200 };
int _CharsetFromOrdering(const CFX_ByteString& Ordering)
{
- int charset = 1;
- while (g_CharsetNames[charset] && Ordering != CFX_ByteStringC(g_CharsetNames[charset])) {
- charset ++;
- }
- if (g_CharsetNames[charset] == NULL) {
- return CIDSET_UNKNOWN;
- }
- return charset;
+ for (int charset = 1; charset < NUMBER_OF_CIDSETS; charset++) {
+ if (Ordering == CFX_ByteStringC(g_CharsetNames[charset]))
+ return charset;
+ }
+ return CIDSET_UNKNOWN;
}
void CPDF_CMapManager::ReloadAll()
{
« no previous file with comments | « core/src/fpdfapi/fpdf_font/font_int.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698