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

Side by Side Diff: core/fxge/dib/fx_dib_engine.cpp

Issue 2404453003: Strengthen bounds check in CWeightTable::Calc * part II (Closed)
Patch Set: A better implementation of GetPixelWeightSize 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 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 <limits.h> 7 #include <limits.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 25 matching lines...) Expand all
36 : m_DestMin(0), 36 : m_DestMin(0),
37 m_ItemSize(0), 37 m_ItemSize(0),
38 m_pWeightTables(nullptr), 38 m_pWeightTables(nullptr),
39 m_dwWeightTablesSize(0) {} 39 m_dwWeightTablesSize(0) {}
40 40
41 CWeightTable::~CWeightTable() { 41 CWeightTable::~CWeightTable() {
42 FX_Free(m_pWeightTables); 42 FX_Free(m_pWeightTables);
43 } 43 }
44 44
45 size_t CWeightTable::GetPixelWeightSize() const { 45 size_t CWeightTable::GetPixelWeightSize() const {
46 return m_dwWeightTablesSize / sizeof(int); 46 return (m_ItemSize - sizeof(int) * 2) / sizeof(int);
Lei Zhang 2016/10/14 23:51:54 How about: (m_ItemSize / sizeof(int)) - 2;
47 } 47 }
48 48
49 bool CWeightTable::Calc(int dest_len, 49 bool CWeightTable::Calc(int dest_len,
50 int dest_min, 50 int dest_min,
51 int dest_max, 51 int dest_max,
52 int src_len, 52 int src_len,
53 int src_min, 53 int src_min,
54 int src_max, 54 int src_max,
55 int flags) { 55 int flags) {
56 FX_Free(m_pWeightTables); 56 FX_Free(m_pWeightTables);
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 result_width); 999 result_width);
1000 if (m_pMaskScanline) { 1000 if (m_pMaskScanline) {
1001 m_pSource->m_pAlphaMask->DownSampleScanline( 1001 m_pSource->m_pAlphaMask->DownSampleScanline(
1002 src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX, 1002 src_y, m_pMaskScanline.get(), 1, m_DestWidth, m_bFlipX,
1003 m_ClipRect.left, result_width); 1003 m_ClipRect.left, result_width);
1004 } 1004 }
1005 m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get()); 1005 m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get());
1006 } 1006 }
1007 return FALSE; 1007 return FALSE;
1008 } 1008 }
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