]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
There must be at least one element in a VLA.
authorFlorian Krohm <florian@eich-krohm.de>
Fri, 6 Feb 2015 20:25:57 +0000 (20:25 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Fri, 6 Feb 2015 20:25:57 +0000 (20:25 +0000)
Found by libubsan.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14912

coregrind/m_demangle/cp-demangle.c

index 3489e75415866b64ec64368de05e79baaa7b7a76..e311e3f5e3bb14a7167eadeff569d1fa49e33588 100644 (file)
@@ -4071,8 +4071,8 @@ cplus_demangle_print_callback (int options,
 
   {
 #ifdef CP_DYNAMIC_ARRAYS
-    __extension__ struct d_saved_scope scopes[dpi.num_saved_scopes];
-    __extension__ struct d_print_template temps[dpi.num_copy_templates];
+    __extension__ struct d_saved_scope scopes[dpi.num_saved_scopes ?: 1];
+    __extension__ struct d_print_template temps[dpi.num_copy_templates ?: 1];
 
     dpi.saved_scopes = scopes;
     dpi.copy_templates = temps;