[Bug demangler/81684] Out of Memory in demangler

2017-08-03 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81684

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|NEW |UNCONFIRMED
 Ever confirmed|1   |0

--- Comment #3 from Markus Trippelsdorf  ---
None of the submitted demangler bugs are reproducible when using 
the libiberty demangler directly. So these should all be moved to
the sourceware.org/bugzilla.

To test libiberty directly you can use something like:

trippels@gcc2-power8 ~ % cat fuzz.cpp
#include 
#include 
#include 
#include 

extern "C" char* cplus_demangle_v3(const char *mangled, int options);

extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  char *str = new char[size + 1];
  memcpy(str, data, size);
  str[size] = 0;
  free(cplus_demangle_v3(str, 19 /* DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES */));
  delete[] str;
  return 0;
}
trippels@gcc2-power8 ~ % clang++ -O2 -g -fsanitize-coverage=trace-pc-guard
-fsanitize=address -pthread fuzz.cpp ~/Fuzzer/libFuzzer.a ./libiberty.a

(after configuring and building in gcc/libiberty to get libiberty.a).

[Bug demangler/81684] Out of Memory in demangler

2017-08-03 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81684

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-03
 CC||trippels at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Markus Trippelsdorf  ---
Confirmed:

~ % c++filt __H99_
c++filt: out of memory allocating 11280523256 bytes after a total of 135168
bytes

Currently the demangler is not in shape for fuzzing. For example, it contains
several quadratic algorithms, see e.g. PR80002.

Also I'm not sure if fixing all small memory leaks is really worth the effort.

[Bug demangler/81684] Out of Memory in demangler

2017-08-02 Thread security-tps at google dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81684

--- Comment #1 from Google-Autofuzz  ---
Created attachment 41910
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41910&action=edit
Demangler PoC