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

Side by Side Diff: core/fpdfapi/page/cpdf_streamcontentparser.cpp

Issue 2425843002: Fix segv in AddImage() (Closed)
Patch Set: Fix ownership Created 4 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/page/cpdf_streamcontentparser.h" 7 #include "core/fpdfapi/page/cpdf_streamcontentparser.h"
8 8
9 #include "core/fpdfapi/font/cpdf_font.h" 9 #include "core/fpdfapi/font/cpdf_font.h"
10 #include "core/fpdfapi/font/cpdf_type3font.h" 10 #include "core/fpdfapi/font/cpdf_type3font.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 if (!pXObject) { 662 if (!pXObject) {
663 m_bResourceMissing = true; 663 m_bResourceMissing = true;
664 return; 664 return;
665 } 665 }
666 666
667 CFX_ByteString type; 667 CFX_ByteString type;
668 if (pXObject->GetDict()) 668 if (pXObject->GetDict())
669 type = pXObject->GetDict()->GetStringFor("Subtype"); 669 type = pXObject->GetDict()->GetStringFor("Subtype");
670 670
671 if (type == "Image") { 671 if (type == "Image") {
672 CPDF_ImageObject* pObj = AddImage(pXObject->GetObjNum()); 672 CPDF_ImageObject* pObj =
673 pXObject->IsInline()
674 ? AddImage(UniqueStream(ToStream(pXObject->Clone())))
675 : AddImage(pXObject->GetObjNum());
676
673 m_LastImageName = name; 677 m_LastImageName = name;
674 m_pLastImage = pObj->GetImage(); 678 m_pLastImage = pObj->GetImage();
675 if (!m_pObjectHolder->HasImageMask()) 679 if (!m_pObjectHolder->HasImageMask())
676 m_pObjectHolder->SetHasImageMask(m_pLastImage->IsMask()); 680 m_pObjectHolder->SetHasImageMask(m_pLastImage->IsMask());
677 } else if (type == "Form") { 681 } else if (type == "Form") {
678 AddForm(pXObject); 682 AddForm(pXObject);
679 } 683 }
680 } 684 }
681 685
682 void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { 686 void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 } 1555 }
1552 default: 1556 default:
1553 bProcessed = FALSE; 1557 bProcessed = FALSE;
1554 } 1558 }
1555 if (!bProcessed) { 1559 if (!bProcessed) {
1556 m_pSyntax->SetPos(last_pos); 1560 m_pSyntax->SetPos(last_pos);
1557 return; 1561 return;
1558 } 1562 }
1559 } 1563 }
1560 } 1564 }
OLDNEW
« 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