OSDN Git Service

llvm-undname: Make demangling of MD5 names more robust
authorNico Weber <nicolasweber@gmx.de>
Mon, 27 May 2019 00:48:59 +0000 (00:48 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 27 May 2019 00:48:59 +0000 (00:48 +0000)
commite5bd1bfa35970e7c404b51417c1a5048dd4d2bfb
treec8d7a89ffa432978df05255e170a693ec12c5e17
parenta023a86ed98cb48c4a861b33b062c124c213c45e
llvm-undname: Make demangling of MD5 names more robust

Demangler::parse() for MD5 names would:

1. Put all remaining text into the MD5 name sight unseen
2. Not modify MangledName

This meant that if the demangler recursively called parse() (e.g. in
demangleLocallyScopedNamePiece()), every recursive call that started on
an MD5 name would add all remaining bytes to the output buffer but
only advance the input by a byte.  For valid inputs, MD5 types are
never (well, see comments for 2 exceptions) nested, but for invalid
input this could cause memory use quadratic in the input size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361744 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Demangle/MicrosoftDemangle.cpp
test/Demangle/ms-md5.test