Skip to content

[ItaniumDemangle] Fix libcxxabi OutputBuffer::prepend for empty inputs #138656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025

Conversation

slydiman
Copy link
Contributor

@slydiman slydiman commented May 6, 2025

See #138564 for details.

@slydiman slydiman requested review from zygoloid and Michael137 May 6, 2025 08:51
@slydiman slydiman requested a review from a team as a code owner May 6, 2025 08:51
@llvmbot llvmbot added the libc++abi libc++abi C++ Runtime Library. Not libc++. label May 6, 2025
@llvmbot
Copy link
Member

llvmbot commented May 6, 2025

@llvm/pr-subscribers-libcxxabi

Author: Dmitry Vasilyev (slydiman)

Changes

See #138564 for details.


Full diff: https://github.com/llvm/llvm-project/pull/138656.diff

1 Files Affected:

  • (modified) libcxxabi/src/demangle/Utility.h (+2)
diff --git a/libcxxabi/src/demangle/Utility.h b/libcxxabi/src/demangle/Utility.h
index 511983ad40f7a..8829f3fa13a93 100644
--- a/libcxxabi/src/demangle/Utility.h
+++ b/libcxxabi/src/demangle/Utility.h
@@ -136,6 +136,8 @@ class OutputBuffer {
 
   OutputBuffer &prepend(std::string_view R) {
     size_t Size = R.size();
+    if (!Size)
+      return *this;
 
     grow(Size);
     std::memmove(Buffer + Size, Buffer, CurrentPosition);

@Michael137 Michael137 changed the title Fixed libcxxabi Demangle [ItaniumDemangle] Fix libcxxabi OutputBuffer::prepend for empty inputs May 6, 2025
@slydiman slydiman merged commit 0dce0ea into llvm:main May 6, 2025
18 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants