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

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_image.cpp

Issue 2250533002: Fix stack overflow in object Clone() functions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase again Created 4 years, 3 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 | core/fpdfapi/fpdf_parser/cpdf_array.cpp » ('j') | 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/fpdf_page/include/cpdf_image.h" 7 #include "core/fpdfapi/fpdf_page/include/cpdf_image.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 } 63 }
64 64
65 CPDF_Image* CPDF_Image::Clone() { 65 CPDF_Image* CPDF_Image::Clone() {
66 if (m_pStream->GetObjNum()) 66 if (m_pStream->GetObjNum())
67 return m_pDocument->GetPageData()->GetImage(m_pStream); 67 return m_pDocument->GetPageData()->GetImage(m_pStream);
68 68
69 CPDF_Image* pImage = 69 CPDF_Image* pImage =
70 new CPDF_Image(m_pDocument, ToStream(m_pStream->Clone()), m_bInline); 70 new CPDF_Image(m_pDocument, ToStream(m_pStream->Clone()), m_bInline);
71 if (m_bInline) 71 if (m_bInline)
72 pImage->SetInlineDict(ToDictionary(m_pInlineDict->Clone(TRUE))); 72 pImage->SetInlineDict(ToDictionary(m_pInlineDict->CloneDirectObject()));
73 73
74 return pImage; 74 return pImage;
75 } 75 }
76 76
77 CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) { 77 CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
78 int32_t width; 78 int32_t width;
79 int32_t height; 79 int32_t height;
80 int32_t num_comps; 80 int32_t num_comps;
81 int32_t bits; 81 int32_t bits;
82 bool color_trans; 82 bool color_trans;
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 if (!ret) { 401 if (!ret) {
402 delete m_pDIBSource; 402 delete m_pDIBSource;
403 m_pDIBSource = nullptr; 403 m_pDIBSource = nullptr;
404 return FALSE; 404 return FALSE;
405 } 405 }
406 m_pMask = pSource->DetachMask(); 406 m_pMask = pSource->DetachMask();
407 m_MatteColor = pSource->GetMatteColor(); 407 m_MatteColor = pSource->GetMatteColor();
408 return FALSE; 408 return FALSE;
409 } 409 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_array.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698