Author: Kostya Kortchinsky Date: 2020-12-02T16:10:50-08:00 New Revision: 0a09c1cc9dcbec8126344123e9481bed6524e5ec
URL: https://github.com/llvm/llvm-project/commit/0a09c1cc9dcbec8126344123e9481bed6524e5ec DIFF: https://github.com/llvm/llvm-project/commit/0a09c1cc9dcbec8126344123e9481bed6524e5ec.diff LOG: [scudo][standalone] Add missing va_end() in ScopedString::append In ScopedString::append va_list ArgsCopy is created but never cleanuped which can lead to undefined behaviour, like stack corruption. Reviewed By: cryptoad Differential Revision: https://reviews.llvm.org/D92383 Added: Modified: compiler-rt/lib/scudo/standalone/string_utils.cpp Removed: ################################################################################ diff --git a/compiler-rt/lib/scudo/standalone/string_utils.cpp b/compiler-rt/lib/scudo/standalone/string_utils.cpp index 7578123da361..f304491019b2 100644 --- a/compiler-rt/lib/scudo/standalone/string_utils.cpp +++ b/compiler-rt/lib/scudo/standalone/string_utils.cpp @@ -222,6 +222,7 @@ void ScopedString::append(const char *Format, va_list Args) { static_cast<uptr>(formatString(C, sizeof(C), Format, Args)) + 1; String.resize(Length + AdditionalLength); formatString(String.data() + Length, AdditionalLength, Format, ArgsCopy); + va_end(ArgsCopy); Length = strlen(String.data()); CHECK_LT(Length, String.size()); } _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits