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

Unified 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 side-by-side diff with in-line comments
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')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxge/dib/dib_int.h
diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h
index 61533baf2cf99e51d1dde7b79b13828e29d21224..aa4a7927fbcaa4dcd3cab8bfcd1b4b31dd3abbba 100644
--- a/core/fxge/dib/dib_int.h
+++ b/core/fxge/dib/dib_int.h
@@ -40,25 +40,27 @@ struct PixelWeight {
int m_SrcEnd;
int m_Weights[1];
};
+
class CWeightTable {
public:
- CWeightTable() { m_pWeightTables = nullptr; }
- ~CWeightTable() {
- FX_Free(m_pWeightTables);
- m_pWeightTables = nullptr;
- }
- void Calc(int dest_len,
+ CWeightTable();
+ ~CWeightTable();
+
+ bool Calc(int dest_len,
int dest_min,
int dest_max,
int src_len,
int src_min,
int src_max,
int flags);
- PixelWeight* GetPixelWeight(int pixel) {
- return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
- }
- int m_DestMin, m_ItemSize;
+ PixelWeight* GetPixelWeight(int pixel) const;
+ int* GetValueFromPixelWeight(PixelWeight* pWeight, int index) const;
+
+ private:
+ int m_DestMin;
+ int m_ItemSize;
uint8_t* m_pWeightTables;
+ size_t m_dwWeightTablesSize;
};
class CStretchEngine {
« 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