Re: branch-1_4 allocation overflow
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
-----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 <[email protected]> * 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 [email protected] -----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-----