Treat null Parent as no Parent for dictionary objects To be complient with PDF reference chapter 7.3.7 BUG=402437 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/469573002
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index 032c3db..b8d2125 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp
@@ -215,8 +215,11 @@ { 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; }