[fdo-trac] #575: Out-of-memory exception is not handled very well
in FdoArrayHelper::AllocMore(...)
FDO
trac_fdo at osgeo.org
Tue Oct 27 23:15:12 EDT 2009
#575: Out-of-memory exception is not handled very well in
FdoArrayHelper::AllocMore(...)
--------------------------+-------------------------------------------------
Reporter: Wesley | Owner: Wesley
Type: defect | Status: new
Priority: major | Milestone: 3.5.0
Component: FDO API | Version: 3.4.0
Severity: 1 | Keywords: Out-of-memory exception crash
External_id: 1269041.01 |
--------------------------+-------------------------------------------------
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.
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/575>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list