This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/78584] New: Bug in GCC argument parser expandargv


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78584

            Bug ID: 78584
           Summary: Bug in GCC argument parser expandargv
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: boehme.marcel at gmail dot com
  Target Milestone: ---

Dear all,

Passing "@." or "@<any valid path>" as argument causes gcc, gcov, and all of
binutils to fail after trying to allocate a large (but fixed) chunk of memory
(0x7FFFFFFFFFFFFFFF on my x86_64 Ubuntu 14.04 machine).

The bug was found with AFLFast, a fork of AFL. Thanks also to Van-Thuan Pham.

For instance,
$ gcc @.
$ ld @.
$ objdump @.
$ gcov @.

Valgrind reports for objdump:
==146416== Argument 'size' of function malloc has a fishy (possibly negative)
value: -9223372036854775808
==146416==    at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==146416==    by 0x9AB300: xmalloc (xmalloc.c:147)
==146416==    by 0x971BC2: expandargv (argv.c:415)
==146416==    by 0x40A47F: main (objdump.c:3558)
==146416== 

binutils/objdump: out of memory allocating 9223372036854775808 bytes after a
total of 0 bytes

So, the error is likely in Libiberty's argv.c.

Note that "@." is a valid file name.

Best regards,
- Marcel

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]