From ca2b127a7a9ea5685873816805609b80e254b4da Mon Sep 17 00:00:00 2001 From: Simon Chopin Date: Wed, 10 Apr 2024 11:25:19 +0200 Subject: [PATCH] don't use a VLA just to compute a buffer size VLAs in C++ are compiler extensions, and clang will complain about it. Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libelfin/+bug/2060786 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1065084 --- dwarf/small_vector.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwarf/small_vector.hh b/dwarf/small_vector.hh index e73ab60..9437328 100644 --- a/dwarf/small_vector.hh +++ b/dwarf/small_vector.hh @@ -93,7 +93,7 @@ public: while (target < n) target <<= 1; - char *newbuf = new char[sizeof(T[target])]; + char *newbuf = new char[target * sizeof(T)]; T *src = base, *dest = (T*)newbuf; for (; src < end; src++, dest++) { new(dest) T(*src);