Fix m_ExtGID usage in CPDF_CharPosList

This CL allows Apple to use m_GlyphIndex as a replacement for m_ExtGID
when it is invalid.

Bug: pdfium:1121
Change-Id: I49e7936201815bae5a2c8a26680fc1e542a60c43
Reviewed-on: https://pdfium-review.googlesource.com/37390
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index ddb215c..7c0e288 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -41,7 +41,9 @@
     uint32_t GlyphID = charpos.m_GlyphIndex;
 #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
     charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode);
-    GlyphID = charpos.m_ExtGID;
+    GlyphID = charpos.m_ExtGID != static_cast<uint32_t>(-1)
+                  ? charpos.m_ExtGID
+                  : charpos.m_GlyphIndex;
 #endif
     CFX_Font* pCurrentFont;
     if (GlyphID != static_cast<uint32_t>(-1)) {