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

Side by Side Diff: core/fpdfapi/fpdf_render/fpdf_render_image.cpp

Issue 2323473002: Verify image dimentions before using (Closed)
Patch Set: 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 | 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 "core/fpdfapi/fpdf_render/render_int.h" 7 #include "core/fpdfapi/fpdf_render/render_int.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 CPDF_ImageRenderer::~CPDF_ImageRenderer() { 360 CPDF_ImageRenderer::~CPDF_ImageRenderer() {
361 if (m_DeviceHandle) { 361 if (m_DeviceHandle) {
362 m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle); 362 m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle);
363 } 363 }
364 } 364 }
365 365
366 FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() { 366 FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
367 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); 367 CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
368 FX_RECT image_rect = image_rect_f.GetOuterRect(); 368 FX_RECT image_rect = image_rect_f.GetOuterRect();
369 if (!image_rect.Valid())
370 return FALSE;
371
369 int dest_width = image_rect.Width(); 372 int dest_width = image_rect.Width();
370 int dest_height = image_rect.Height(); 373 int dest_height = image_rect.Height();
371 if (m_ImageMatrix.a < 0) { 374 if (m_ImageMatrix.a < 0) {
372 dest_width = -dest_width; 375 dest_width = -dest_width;
373 } 376 }
374 if (m_ImageMatrix.d > 0) { 377 if (m_ImageMatrix.d > 0) {
375 dest_height = -dest_height; 378 dest_height = -dest_height;
376 } 379 }
377 if (m_Loader.Start(m_pImageObject, 380 if (m_Loader.Start(m_pImageObject,
378 m_pRenderStatus->m_pContext->GetPageCache(), &m_LoadHandle, 381 m_pRenderStatus->m_pContext->GetPageCache(), &m_LoadHandle,
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 } else if (pFunc) { 1070 } else if (pFunc) {
1068 int size = dest_pitch * height; 1071 int size = dest_pitch * height;
1069 for (int i = 0; i < size; i++) { 1072 for (int i = 0; i < size; i++) {
1070 dest_buf[i] = transfers[src_buf[i]]; 1073 dest_buf[i] = transfers[src_buf[i]];
1071 } 1074 }
1072 } else { 1075 } else {
1073 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); 1076 FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height);
1074 } 1077 }
1075 return pMask.release(); 1078 return pMask.release();
1076 } 1079 }
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