Resolve compilation error with G++ 4.9.
authorTom Sepez <tsepez@chromium.org>
Wed, 29 Oct 2014 22:31:20 +0000 (15:31 -0700)
committerTom Sepez <tsepez@chromium.org>
Wed, 29 Oct 2014 22:31:20 +0000 (15:31 -0700)
Add a check for zero-length keys to avoid hitting the equivalent of |""[1]|.
BUG=https://code.google.com/p/pdfium/issues/detail?id=58
R=jun_fang@foxitsoftware.com

Review URL: https://codereview.chromium.org/665223003

core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

index e9c0fdd..5df4a6f 100644 (file)
@@ -2192,9 +2192,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
             if (pObj == NULL) {
                 continue;
             }
-            if (key.GetLength() == 1) {
-                pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj);
-            } else {
+            if (key.GetLength() >= 1) {
                 if (nKeys < 32) {
                     pDict->SetAt(CFX_ByteStringC(((FX_LPCSTR)key) + 1, key.GetLength() - 1), pObj);
                 } else {