]> git.pld-linux.org Git - packages/php.git/blob - php-5.1.6-CVE-2007-1001.patch
- ac-branch merge
[packages/php.git] / php-5.1.6-CVE-2007-1001.patch
1 --- php-5.1.6/ext/gd/libgd/wbmp.c.cve1001
2 +++ php-5.1.6/ext/gd/libgd/wbmp.c
3 @@ -102,6 +102,8 @@
4    return (0);
5  }
6  
7 +#define SAFE_MULTIPLE(x,y) (x == 0 || y == 0 || (x > 0 && y > 0 && (x < INT_MAX / y)))
8 +
9  /* create wbmp
10     ** -----------
11     ** create an empty wbmp
12 @@ -116,6 +118,12 @@
13    if ((wbmp = (Wbmp *) gdMalloc (sizeof (Wbmp))) == NULL)
14      return (NULL);
15  
16 +  if (!SAFE_MULTIPLE(width, height)) {
17 +      php_gd_error("createwbmp: Integer overflow from WBMP image height/width (%d x %d)\n", width, height);
18 +      gdFree(wbmp);
19 +      return NULL;
20 +  }
21 +
22    if ((wbmp->bitmap = (int *) safe_emalloc(sizeof(int), width * height, 0)) == NULL)
23      {
24        gdFree (wbmp);
25 @@ -176,6 +184,13 @@
26    printf ("W: %d, H: %d\n", wbmp->width, wbmp->height);
27  #endif
28  
29 +  if (!SAFE_MULTIPLE(wbmp->width, wbmp->height)) {
30 +      php_gd_error("readwbmp: Integer overflow from WBMP image height/width (%d x %d)\n", 
31 +                   wbmp->width, wbmp->height);
32 +      gdFree(wbmp);
33 +      return (-1);
34 +  }
35 +
36    if ((wbmp->bitmap = (int *) safe_emalloc(wbmp->width * wbmp->height, sizeof(int), 0)) == NULL)
37      {
38        gdFree (wbmp);
This page took 0.052988 seconds and 3 git commands to generate.