+2009-11-25 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
+
+ * mingwex/gdtoa/misc.c: Fix security vulnerability in gdtoa:
+ http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0689
+
2009-11-13 Chris Sutcliffe <ir0nh34d@users.sourceforge.net>
* include/io.h (_open_osfhandle): Correct definition.
x = 1 << k;
#ifdef Omit_Private_Memory
rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
+ if (rv == NULL)
+ return NULL;
#else
len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1)
/sizeof(double);
pmem_next += len;
}
else
+ {
rv = (Bigint*)MALLOC(len*sizeof(double));
+ if (rv == NULL)
+ return NULL;
+ }
#endif
rv->k = k;
rv->maxwds = x;
if (carry) {
if (wds >= b->maxwds) {
b1 = Balloc(b->k+1);
+ if (b1 == NULL)
+ return NULL;
Bcopy(b1, b);
Bfree(b);
b = b1;
Bigint *b;
b = Balloc(1);
+ if (b == NULL)
+ return NULL;
b->x[0] = i;
b->wds = 1;
return b;
if (wc > a->maxwds)
k++;
c = Balloc(k);
+ if (c == NULL)
+ return NULL;
for(x = c->x, xa = x + wc; x < xa; x++)
*x = 0;
xa = a->x;
static int p05[3] = { 5, 25, 125 };
if ( (i = k & 3) !=0)
- b = multadd(b, p05[i-1], 0);
+ {
+ b = multadd(b, p05[i-1], 0);
+ if (b == NULL)
+ return NULL;
+ }
if (!(k >>= 2))
return b;
ACQUIRE_DTOA_LOCK(1);
if (!(p5 = p5s)) {
p5 = p5s = i2b(625);
+ if (p5 == NULL)
+ return NULL;
p5->next = 0;
}
FREE_DTOA_LOCK(1);
#else
p5 = p5s = i2b(625);
+ if (p5 == NULL)
+ return NULL;
p5->next = 0;
#endif
}
for(;;) {
if (k & 1) {
b1 = mult(b, p5);
+ if (b1 == NULL)
+ return NULL;
Bfree(b);
b = b1;
}
ACQUIRE_DTOA_LOCK(1);
if (!(p51 = p5->next)) {
p51 = p5->next = mult(p5,p5);
+ if (p51 == NULL)
+ return NULL;
p51->next = 0;
}
FREE_DTOA_LOCK(1);
#else
p51 = p5->next = mult(p5,p5);
+ if (p51 == NULL)
+ return NULL;
p51->next = 0;
#endif
}
for(i = b->maxwds; n1 > i; i <<= 1)
k1++;
b1 = Balloc(k1);
+ if (b1 == NULL)
+ return NULL;
x1 = b1->x;
for(i = 0; i < n; i++)
*x1++ = 0;
i = cmp(a,b);
if (!i) {
c = Balloc(0);
+ if (c == NULL)
+ return NULL;
c->wds = 1;
c->x[0] = 0;
return c;
else
i = 0;
c = Balloc(a->k);
+ if (c == NULL)
+ return NULL;
c->sign = i;
wa = a->wds;
xa = a->x;
#else
b = Balloc(2);
#endif
+ if (b == NULL)
+ return NULL;
x = b->x;
z = d0 & Frac_mask;