Catch maximum number of times and return out of memory error.

This commit is contained in:
Aric Stewart 2002-01-15 20:43:05 +00:00 committed by Alexandre Julliard
parent 638ae43c89
commit ca2f40bd9a
1 changed files with 4 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <string.h>
#include <stdlib.h> /* atoi */
#include <ctype.h>
#include <limits.h>
#include "commctrl.h"
#include "objbase.h"
@ -109,6 +110,9 @@ DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lPar
errCode = E_FAIL;
}
if (streamData.dwItems > (UINT_MAX / 2 / sizeof(VOID*))) /* 536870911 */
return E_OUTOFMEMORY;
/* create the dpa */
hDpa = DPA_Create (streamData.dwItems);
if (!hDpa)