Commit ca2f40bd authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

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

parent 638ae43c
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> /* atoi */ #include <stdlib.h> /* atoi */
#include <ctype.h> #include <ctype.h>
#include <limits.h>
#include "commctrl.h" #include "commctrl.h"
#include "objbase.h" #include "objbase.h"
...@@ -109,6 +110,9 @@ DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lPar ...@@ -109,6 +110,9 @@ DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lPar
errCode = E_FAIL; errCode = E_FAIL;
} }
if (streamData.dwItems > (UINT_MAX / 2 / sizeof(VOID*))) /* 536870911 */
return E_OUTOFMEMORY;
/* create the dpa */ /* create the dpa */
hDpa = DPA_Create (streamData.dwItems); hDpa = DPA_Create (streamData.dwItems);
if (!hDpa) if (!hDpa)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment