Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#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 Wesley, 15 years ago

Resolution: fixed
Status: newclosed

comment:2 by waltweltonlair, 15 years ago

Fixed in trunk with r5050.

comment:3 by waltweltonlair, 14 years ago

Fixed in 3.4 branch with r5051.

comment:4 by waltweltonlair, 14 years ago

Submitted additional fix to trunk stream with r5137.

Note: See TracTickets for help on using tickets.