bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison 1.30e parser can dump core if malloc or alloca fails, etc.


From: Akim Demaille
Subject: Re: Bison 1.30e parser can dump core if malloc or alloca fails, etc.
Date: 29 Nov 2001 12:15:59 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

| Here is a fix for some more memory allocation problems with the parser
| generated by Bison 1.30e.  Sorry, I haven't had time to tease out
| these into separate patches, but if you don't like part of this patch
| please let me know and I'll reformulate it.
| 
| Here are the problems:
| 
| * If malloc fails, the Bison 1.30e parser dereferences the null
|   pointer and this can cause a core dump.  The parser should instead
|   report a stack overflow.

:-)=)

| * On non-GCC hosts where size_t is wider than unsigned int
|   (e.g. 64-bit Solaris 8 cc), Bison mishandles reallocation of stacks
|   that are larger than UINT_MAX bytes.
| 
|   (I realize that there are other problems with Bison on many 64-bit
|   hosts, but I haven't have time to address the others.)

Thanks for addressing this!

| * Bison calls malloc 3 times each time it grows the stack.  It's
|   typically faster and less fragmentation-prone to call malloc just
|   once.

I'm not the improvement is really significant on actual uses, but
given that the code is readable, there is no point in not going that
way.

Thanks _a lot_.  Please, install in the two branches.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]