summaryrefslogtreecommitdiff
path: root/core/include/fxcrt/fx_basic.h
diff options
context:
space:
mode:
authorChris Palmer <palmer@google.com>2014-07-23 15:00:32 -0700
committerChris Palmer <palmer@google.com>2014-07-23 15:00:32 -0700
commita08cf99d066b16e4e16393efc15174193e002371 (patch)
tree8199f4122d1bdb2ca7211eb817002e97e11ee251 /core/include/fxcrt/fx_basic.h
parent141d61d1f6255923f46b6f0b97614e27c9c4dc86 (diff)
downloadpdfium-chromium/2110.tar.xz
The |nGrowBy| argument to |SetSize| was always -1, which caused the effective m_nGrowBy value to always be its default value: 0. So it was not needed, and was cluttering up the logic. BUG=384662 Check for integer overflow in CFX_BasicArray. BUG=384662 R=bo_xu@foxitsoftware.com, rsesek@chromium.org Review URL: https://codereview.chromium.org/415803002
Diffstat (limited to 'core/include/fxcrt/fx_basic.h')
-rw-r--r--core/include/fxcrt/fx_basic.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index c400a940ff..ece2b43a2e 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -350,7 +350,7 @@ protected:
~CFX_BasicArray();
- FX_BOOL SetSize(int nNewSize, int nGrowBy);
+ FX_BOOL SetSize(int nNewSize);
FX_BOOL Append(const CFX_BasicArray& src);
@@ -371,8 +371,6 @@ protected:
int m_nMaxSize;
- int m_nGrowBy;
-
int m_nUnitSize;
};
template<class TYPE>
@@ -391,14 +389,14 @@ public:
return m_nSize - 1;
}
- FX_BOOL SetSize(int nNewSize, int nGrowBy = -1)
+ FX_BOOL SetSize(int nNewSize)
{
- return CFX_BasicArray::SetSize(nNewSize, nGrowBy);
+ return CFX_BasicArray::SetSize(nNewSize);
}
void RemoveAll()
{
- SetSize(0, -1);
+ SetSize(0);
}
const TYPE GetAt(int nIndex) const
@@ -442,7 +440,7 @@ public:
return FALSE;
}
if (nIndex >= m_nSize)
- if (!SetSize(nIndex + 1, -1)) {
+ if (!SetSize(nIndex + 1)) {
return FALSE;
}
((TYPE*)m_pData)[nIndex] = newElement;
@@ -453,7 +451,7 @@ public:
{
if (m_nSize < m_nMaxSize) {
m_nSize ++;
- } else if (!SetSize(m_nSize + 1, -1)) {
+ } else if (!SetSize(m_nSize + 1)) {
return FALSE;
}
((TYPE*)m_pData)[m_nSize - 1] = newElement;
@@ -616,7 +614,7 @@ public:
return 0;
}
RemoveAll();
- SetSize(nCount, -1);
+ SetSize(nCount);
ObjectClass* pStartObj = (ObjectClass*)m_pData;
nSize = nStart + nCount;
for (FX_INT32 i = nStart; i < nSize; i ++, pStartObj++) {
@@ -653,7 +651,7 @@ public:
for (int i = 0; i < m_nSize; i ++) {
((ObjectClass*)GetDataPtr(i))->~ObjectClass();
}
- CFX_BasicArray::SetSize(0, -1);
+ CFX_BasicArray::SetSize(0);
}
};
typedef CFX_ObjectArray<CFX_ByteString> CFX_ByteStringArray;