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

Side by Side Diff: core/fxge/ge/fx_ge_device.cpp

Issue 2226023002: Fixup various overflow conditions (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Review cleanup Created 4 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/fxcrt/include/fx_coordinates.h ('k') | third_party/agg23/0002-ubsan-error-fixes.patch » ('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 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/fxge/include/cfx_pathdata.h" 7 #include "core/fxge/include/cfx_pathdata.h"
8 #include "core/fxge/include/fx_ge.h" 8 #include "core/fxge/include/fx_ge.h"
9 #include "core/fxge/include/ifx_renderdevicedriver.h" 9 #include "core/fxge/include/ifx_renderdevicedriver.h"
10 10
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, fill_color, fill_mode, 163 DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, fill_color, fill_mode,
164 blend_type); 164 blend_type);
165 return TRUE; 165 return TRUE;
166 } 166 }
167 if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) && 167 if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) &&
168 stroke_alpha == 0) { 168 stroke_alpha == 0) {
169 CFX_FloatRect rect_f; 169 CFX_FloatRect rect_f;
170 if (!(fill_mode & FXFILL_RECT_AA) && 170 if (!(fill_mode & FXFILL_RECT_AA) &&
171 pPathData->IsRect(pObject2Device, &rect_f)) { 171 pPathData->IsRect(pObject2Device, &rect_f)) {
172 FX_RECT rect_i = rect_f.GetOutterRect(); 172 FX_RECT rect_i = rect_f.GetOutterRect();
173
174 // Depending on the top/bottom, left/right values of the rect it's
175 // possible to overflow the Width() and Height() calculations. Check that
176 // the rect will have valid dimension before continuing.
177 if (!rect_i.Valid())
178 return FALSE;
179
173 int width = (int)FXSYS_ceil(rect_f.right - rect_f.left); 180 int width = (int)FXSYS_ceil(rect_f.right - rect_f.left);
174 if (width < 1) { 181 if (width < 1) {
175 width = 1; 182 width = 1;
176 if (rect_i.left == rect_i.right) { 183 if (rect_i.left == rect_i.right) {
177 rect_i.right++; 184 rect_i.right++;
178 } 185 }
179 } 186 }
180 int height = (int)FXSYS_ceil(rect_f.top - rect_f.bottom); 187 int height = (int)FXSYS_ceil(rect_f.top - rect_f.bottom);
181 if (height < 1) { 188 if (height < 1) {
182 height = 1; 189 height = 1;
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 void CFX_RenderDevice::CancelDIBits(void* handle) { 495 void CFX_RenderDevice::CancelDIBits(void* handle) {
489 m_pDeviceDriver->CancelDIBits(handle); 496 m_pDeviceDriver->CancelDIBits(handle);
490 } 497 }
491 498
492 #ifdef _SKIA_SUPPORT_ 499 #ifdef _SKIA_SUPPORT_
493 500
494 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const { 501 void CFX_RenderDevice::DebugVerifyBitmapIsPreMultiplied() const {
495 SkASSERT(0); 502 SkASSERT(0);
496 } 503 }
497 #endif 504 #endif
OLDNEW
« no previous file with comments | « core/fxcrt/include/fx_coordinates.h ('k') | third_party/agg23/0002-ubsan-error-fixes.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698