"Aric" == Aric Stewart aric@codeweavers.com writes:
Aric> + if (streamData.dwItems > 536870911)
Shouldn't have such a magic number either a comment or better be defined as a constant with some sensible name?
Bye
True true,
here instead of a constant i instead show how i came up with the number. This is also more portable if wine ever gets moved to a system with a larger UINT_MAX.
-aric
Uwe Bonnes wrote:
"Aric" == Aric Stewart aric@codeweavers.com writes:
Aric> + if (streamData.dwItems > 536870911)
Shouldn't have such a magic number either a comment or better be defined as a constant with some sensible name?
Bye
-- Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: dlls/comctl32/comctl32undoc.c =================================================================== RCS file: /home/wine/wine/dlls/comctl32/comctl32undoc.c,v retrieving revision 1.54 diff -u -u -r1.54 comctl32undoc.c --- dlls/comctl32/comctl32undoc.c 2002/01/14 18:36:03 1.54 +++ dlls/comctl32/comctl32undoc.c 2002/01/15 12:37:31 @@ -19,6 +19,7 @@ #include <string.h> #include <stdlib.h> /* atoi */ #include <ctype.h> +#include <limits.h>
#include "commctrl.h" #include "objbase.h" @@ -108,6 +109,9 @@ streamData.dwData2 < 1) { errCode = E_FAIL; } + + if (streamData.dwItems > (UINT_MAX / 2 / sizeof(VOID*))) /* 536870911 */ + return E_OUTOFMEMORY;
/* create the dpa */ hDpa = DPA_Create (streamData.dwItems);