Skip to content

Commit

Permalink
don't use a VLA just to compute a buffer size
Browse files Browse the repository at this point in the history
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
  • Loading branch information
schopin-pro committed Apr 10, 2024
1 parent e017276 commit ca2b127
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dwarf/small_vector.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ca2b127

Please sign in to comment.