#575 closed defect (fixed)
Out-of-memory exception is not handled very well in FdoArrayHelper::AllocMore(...)
Reported by: | Wesley | Owned by: | Wesley |
---|---|---|---|
Priority: | major | Milestone: | 3.5.0 |
Component: | FDO API | Version: | 3.4.0 |
Severity: | 1 | Keywords: | Out-of-memory exception crash |
Cc: | External ID: | 1269041.01 |
Description
In FdoArrayHelper::AllocMore(..), the following code is used to allocate more memory.
if (NULL == newArray)
newArray = (GenericArray*) new FdoByte[newAllocBytes];
if (0==newArray)
throw FdoException::Create(FdoException::NLSGetMessage(FDO_NLSID
(FDO_1_BADALLOC)));
If there is no enough memory, an out-of-memory exception will be thrown while using operator "new". Since this exception is not caught, the next IF statement will not work and application may crash.
FdoArrayHelper::AllocMore(...) is a public API. Therefore, when it is used to allocate large memory, it is likely to cause crash.
To fix it, catching any exception and depending on the next statement to verify if it fails or not, that is enough.
Change History (4)
comment:1 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in trunk with r5050.