From 8d05eb8556590bf8fd7e820574425439aab3123b Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 24 Apr 2019 16:09:38 +0000 Subject: llvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz llvm-svn: 359109 --- llvm/lib/Demangle/MicrosoftDemangle.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Demangle') diff --git a/llvm/lib/Demangle/MicrosoftDemangle.cpp b/llvm/lib/Demangle/MicrosoftDemangle.cpp index 14c6e1e5ef5..4942e0e3655 100644 --- a/llvm/lib/Demangle/MicrosoftDemangle.cpp +++ b/llvm/lib/Demangle/MicrosoftDemangle.cpp @@ -1154,8 +1154,11 @@ static unsigned countEmbeddedNulls(const uint8_t *StringBytes, return Result; } +// A mangled (non-wide) string literal stores the total length of the string it +// refers to (passed in NumBytes), and it contains up to 32 bytes of actual text +// (passed in StringBytes, NumChars). static unsigned guessCharByteSize(const uint8_t *StringBytes, unsigned NumChars, - unsigned NumBytes) { + uint64_t NumBytes) { assert(NumBytes > 0); // If the number of bytes is odd, this is guaranteed to be a char string. -- cgit v1.2.3