[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] checking for overflow
From: |
Paul Eggert |
Subject: |
Re: [Bug-gnulib] checking for overflow |
Date: |
20 Oct 2003 15:51:02 -0700 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Bruno Haible <address@hidden> writes:
> And for some not-so-large values of N, such as 60000, ls will allocate
> 700 MB of memory. Which also allows some kind of denial-of-service attack.
That bug was fixed too (in a different way).
> For multiplication by 2: can we rely on malloc() failing for sizes between
> 2 GB and 4 GB?
No. For example, on 32-bit Solaris 8 sparc, malloc (SIZE_MAX / 2 + 1)
can succeed.
I suppose we could write a malloc wrapper that always fails for
arguments greater than SIZE_MAX / 2, but that sounds a bit unfriendly
in general.