Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 803103002: Fix a bug that occurs when an object has the same object number with the root object (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 2f834ea400b8f3be2e1f3a313dabf30676746180..c49f8001e30fc699fcf61050b81f2ae303c4ee89 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -1002,8 +1002,13 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE pos, FX_FILESIZE& prev, FX_BOOL
if (!pStream) {
return FALSE;
}
- if (m_pDocument) {
+ if (m_pDocument && m_pDocument->GetRoot()->GetObjNum() != pStream->m_ObjNum) {
Tom Sepez 2014/12/17 18:20:10 If there's no document, we now fail instead of jus
jun_fang 2014/12/17 19:55:53 I thought that it should return if there was no do
m_pDocument->InsertIndirectObject(pStream->m_ObjNum, pStream);
+ } else {
+ if (pStream->GetType() == PDFOBJ_STREAM) {
+ pStream->Release();
+ }
+ return FALSE;
}
if (pStream->GetType() != PDFOBJ_STREAM) {
Tom Sepez 2014/12/17 18:20:10 can this test move to after line 1004? Then when
Tom Sepez 2014/12/17 18:21:28 Rather, there's no need to check before calling re
jun_fang 2014/12/17 19:55:53 Before this fix, release is only called when pStre
return FALSE;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698