Treat null Parent as no Parent for dictionary objects
authorBo Xu <bo_xu@foxitsoftware.com>
Tue, 12 Aug 2014 18:10:51 +0000 (11:10 -0700)
committerBo Xu <bo_xu@foxitsoftware.com>
Tue, 12 Aug 2014 18:10:51 +0000 (11:10 -0700)
To be complient with PDF reference chapter 7.3.7

BUG=402437
R=vitalybuka@chromium.org

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

fpdfsdk/src/fpdfppo.cpp

index 032c3db..b8d2125 100644 (file)
@@ -215,8 +215,11 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag(CPDF_Dictionary *pDic
        {
                if(pp->KeyExist((const char*)nSrctag))  
                        return pp->GetElement((const char*)nSrctag);
-               else if(pp->KeyExist("Parent"))
+               else if (pp->KeyExist("Parent"))
+               {
                        pp = (CPDF_Dictionary*)pp->GetElement("Parent")->GetDirect();
+                       if (pp->GetType() == PDFOBJ_NULL) break;
+               }
                else break;
        }