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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp

Issue 439693002: Fix use-after-free in CPDF_Color::~CPDF_Color (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | 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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "pageint.h" 8 #include "pageint.h"
9
10 CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix) :
11 m_pPatternObj(NULL), m_PatternType(PATTERN_TILING), m_pDocument(NULL), m_pCo lor(NULL)
12 {
13 if (pParentMatrix) {
14 m_ParentMatrix = *pParentMatrix;
15 }
16 }
17
18 CPDF_Pattern::~CPDF_Pattern()
19 {
20 if (m_pColor) {
21 m_pColor->SetValue(NULL, NULL, 0);
22 m_pColor = NULL;
23 }
24 }
9 CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatter nObj, const CFX_AffineMatrix* parentMatrix) : 25 CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatter nObj, const CFX_AffineMatrix* parentMatrix) :
10 CPDF_Pattern(parentMatrix) 26 CPDF_Pattern(parentMatrix)
11 { 27 {
12 m_PatternType = PATTERN_TILING; 28 m_PatternType = PATTERN_TILING;
13 m_pPatternObj = pPatternObj; 29 m_pPatternObj = pPatternObj;
14 m_pDocument = pDoc; 30 m_pDocument = pDoc;
15 CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); 31 CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
16 ASSERT(pDict != NULL); 32 ASSERT(pDict != NULL);
17 m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix")); 33 m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix"));
18 m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1; 34 m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
19 if (parentMatrix) { 35 if (parentMatrix) {
20 m_Pattern2Form.Concat(*parentMatrix); 36 m_Pattern2Form.Concat(*parentMatrix);
21 } 37 }
22 m_pForm = NULL; 38 m_pForm = NULL;
23 } 39 }
24 CPDF_TilingPattern::~CPDF_TilingPattern() 40 CPDF_TilingPattern::~CPDF_TilingPattern()
25 { 41 {
26 if (m_pForm) { 42 if (m_pForm) {
27 delete m_pForm; 43 delete m_pForm;
44 m_pForm = NULL;
28 } 45 }
29 } 46 }
30 FX_BOOL CPDF_TilingPattern::Load() 47 FX_BOOL CPDF_TilingPattern::Load()
31 { 48 {
32 if (m_pForm != NULL) { 49 if (m_pForm != NULL) {
33 return TRUE; 50 return TRUE;
34 } 51 }
35 CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); 52 CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
36 if (pDict == NULL) { 53 if (pDict == NULL) {
37 return FALSE; 54 return FALSE;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 286 }
270 } 287 }
271 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color _count); 288 stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color _count);
272 if (bGouraud) { 289 if (bGouraud) {
273 stream.m_BitStream.ByteAlign(); 290 stream.m_BitStream.ByteAlign();
274 } 291 }
275 } 292 }
276 rect.Transform(pMatrix); 293 rect.Transform(pMatrix);
277 return rect; 294 return rect;
278 } 295 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698