summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Demangle
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2019-04-24 16:09:38 +0000
committerNico Weber <nicolasweber@gmx.de>2019-04-24 16:09:38 +0000
commit8d05eb8556590bf8fd7e820574425439aab3123b (patch)
treee7b08fd697c49e487672c9748c24c043a3b0a155 /llvm/lib/Demangle
parentbce10f159c3af03de03a3959a626eba454ce6eb8 (diff)
downloadbcm5719-llvm-8d05eb8556590bf8fd7e820574425439aab3123b.tar.gz
bcm5719-llvm-8d05eb8556590bf8fd7e820574425439aab3123b.zip
llvm-undname: Fix assert-on->4GiB-string-literal, found by oss-fuzz
llvm-svn: 359109
Diffstat (limited to 'llvm/lib/Demangle')
-rw-r--r--llvm/lib/Demangle/MicrosoftDemangle.cpp5
1 files changed, 4 insertions, 1 deletions
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.
OpenPOWER on IntegriCloud