[libcxx-commits] [libcxxabi] 0dce0ea - [ItaniumDemangle] Fix libcxxabi OutputBuffer::prepend for empty inputs (#138656)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 6 02:16:54 PDT 2025


Author: Dmitry Vasilyev
Date: 2025-05-06T13:16:51+04:00
New Revision: 0dce0ea31cc9fd1d3d082b233b16f9ed123a6ed4

URL: https://github.com/llvm/llvm-project/commit/0dce0ea31cc9fd1d3d082b233b16f9ed123a6ed4
DIFF: https://github.com/llvm/llvm-project/commit/0dce0ea31cc9fd1d3d082b233b16f9ed123a6ed4.diff

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

See #138564 for details.

Added: 
    

Modified: 
    libcxxabi/src/demangle/Utility.h

Removed: 
    


################################################################################
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);


        


More information about the libcxx-commits mailing list