[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: branch-1_4 allocation overflow
From: |
Eric Blake |
Subject: |
Re: branch-1_4 allocation overflow |
Date: |
Wed, 25 Oct 2006 22:54:59 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Eric Blake on 10/25/2006 10:45 PM:
> Whoops. This wrapped around to a 0-size allocation, diverted output to
> the wrong location, and crashed on exit, rather than properly failing (at
> least on my machine, with 32-bit size_t, and less than 2 GB of memory)
> with a more appropriate memory exhausted.
Likewise for this, although since -H is a no-op on head, I'm not sure if
it needs porting:
$ m4 -H $((1<<30))
Segmentation fault (core dumped)
2006-10-25 Eric Blake <address@hidden>
* src/symtab.c (symtab_init): Avoid size_t overflow.
Index: src/symtab.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/symtab.c,v
retrieving revision 1.1.1.1.2.13
diff -u -p -r1.1.1.1.2.13 symtab.c
- --- src/symtab.c 30 Jul 2006 23:46:51 -0000 1.1.1.1.2.13
+++ src/symtab.c 26 Oct 2006 04:54:15 -0000
@@ -101,7 +101,7 @@ symtab_init (void)
size_t i;
symbol **s;
- - s = symtab = (symbol **) xmalloc (hash_table_size * sizeof (symbol *));
+ s = symtab = (symbol **) xnmalloc (hash_table_size, sizeof (symbol *));
for (i = 0; i < hash_table_size; i++)
s[i] = NULL;
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFQD+j84KuGfSFAYARAgN8AJ9i7M4ztljGeOeMwhPOY+YdZYAmywCePNtu
7xg/0IMjjNcXrPsgAXa1ecE=
=iewo
-----END PGP SIGNATURE-----