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

Side by Side Diff: core/fxge/dib/dib_int.h

Issue 2204773003: Add bounds checks to CWeightTable::Calc() and friends. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: store size 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 | « no previous file | core/fxge/dib/fx_dib_engine.cpp » ('j') | core/fxge/dib/fx_dib_engine.cpp » ('J')
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 #ifndef CORE_FXGE_DIB_DIB_INT_H_ 7 #ifndef CORE_FXGE_DIB_DIB_INT_H_
8 #define CORE_FXGE_DIB_DIB_INT_H_ 8 #define CORE_FXGE_DIB_DIB_INT_H_
9 9
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 22 matching lines...) Expand all
33 } 33 }
34 int a, b, c, d, e, f; 34 int a, b, c, d, e, f;
35 int base; 35 int base;
36 }; 36 };
37 #define FPDF_HUGE_IMAGE_SIZE 60000000 37 #define FPDF_HUGE_IMAGE_SIZE 60000000
38 struct PixelWeight { 38 struct PixelWeight {
39 int m_SrcStart; 39 int m_SrcStart;
40 int m_SrcEnd; 40 int m_SrcEnd;
41 int m_Weights[1]; 41 int m_Weights[1];
42 }; 42 };
43
43 class CWeightTable { 44 class CWeightTable {
44 public: 45 public:
45 CWeightTable() { m_pWeightTables = nullptr; } 46 CWeightTable();
46 ~CWeightTable() { 47 ~CWeightTable();
47 FX_Free(m_pWeightTables); 48
48 m_pWeightTables = nullptr; 49 bool Calc(int dest_len,
49 }
50 void Calc(int dest_len,
51 int dest_min, 50 int dest_min,
52 int dest_max, 51 int dest_max,
53 int src_len, 52 int src_len,
54 int src_min, 53 int src_min,
55 int src_max, 54 int src_max,
56 int flags); 55 int flags);
57 PixelWeight* GetPixelWeight(int pixel) { 56 PixelWeight* GetPixelWeight(int pixel) const;
58 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); 57 int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
59 } 58
60 int m_DestMin, m_ItemSize; 59 private:
60 int m_DestMin;
61 int m_ItemSize;
61 uint8_t* m_pWeightTables; 62 uint8_t* m_pWeightTables;
63 size_t m_dwWeightTablesSize;
62 }; 64 };
63 65
64 class CStretchEngine { 66 class CStretchEngine {
65 public: 67 public:
66 CStretchEngine(IFX_ScanlineComposer* pDestBitmap, 68 CStretchEngine(IFX_ScanlineComposer* pDestBitmap,
67 FXDIB_Format dest_format, 69 FXDIB_Format dest_format,
68 int dest_width, 70 int dest_width,
69 int dest_height, 71 int dest_height,
70 const FX_RECT& clip_rect, 72 const FX_RECT& clip_rect,
71 const CFX_DIBSource* pSrcBitmap, 73 const CFX_DIBSource* pSrcBitmap,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 int m_State; 106 int m_State;
105 }; 107 };
106 108
107 FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, 109 FX_RECT FXDIB_SwapClipBox(FX_RECT& clip,
108 int width, 110 int width,
109 int height, 111 int height,
110 FX_BOOL bFlipX, 112 FX_BOOL bFlipX,
111 FX_BOOL bFlipY); 113 FX_BOOL bFlipY);
112 114
113 #endif // CORE_FXGE_DIB_DIB_INT_H_ 115 #endif // CORE_FXGE_DIB_DIB_INT_H_
OLDNEW
« no previous file with comments | « no previous file | core/fxge/dib/fx_dib_engine.cpp » ('j') | core/fxge/dib/fx_dib_engine.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698