Trailer should be a dictionary object
authorBo Xu <bo_xu@foxitsoftware.com>
Tue, 9 Dec 2014 18:13:59 +0000 (10:13 -0800)
committerBo Xu <bo_xu@foxitsoftware.com>
Tue, 9 Dec 2014 18:13:59 +0000 (10:13 -0800)
BUG=https://code.google.com/p/pdfium/issues/detail?id=86

a "<<" token should follow "trailer" but "<" will trick the parser to make trailer a hex string object.

R=tsepez@chromium.org

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

core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

index fb6d72e..66231aa 100644 (file)
@@ -3829,6 +3829,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints)
         CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
         m_syntaxParser.InitParser((IFX_FileStream*)file, 0);
         CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0);
+        if (pTrailer->GetType() != PDFOBJ_DICTIONARY) {
+            return FALSE;
+        }
         if (!pTrailer) {
             m_Pos += m_syntaxParser.SavePos();
             pHints->AddSegment(m_Pos, iTrailerSize);