cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length VLAs.
2016-06-12 Brooks Moses <bmoses@google.com> * cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length VLAs. From-SVN: r238233
This commit is contained in:
parent
3d56e6a465
commit
3f39385351
2 changed files with 11 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2016-06-12 Brooks Moses <bmoses@google.com>
|
||||||
|
|
||||||
|
* cp-demangle.c (cplus_demangle_print_callback): Avoid zero-length
|
||||||
|
VLAs.
|
||||||
|
|
||||||
2016-05-31 Alan Modra <amodra@gmail.com>
|
2016-05-31 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* xmemdup.c (xmemdup): Use xmalloc rather than xcalloc.
|
* xmemdup.c (xmemdup): Use xmalloc rather than xcalloc.
|
||||||
|
|
|
@ -4128,8 +4128,12 @@ cplus_demangle_print_callback (int options,
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef CP_DYNAMIC_ARRAYS
|
#ifdef CP_DYNAMIC_ARRAYS
|
||||||
__extension__ struct d_saved_scope scopes[dpi.num_saved_scopes];
|
/* Avoid zero-length VLAs, which are prohibited by the C99 standard
|
||||||
__extension__ struct d_print_template temps[dpi.num_copy_templates];
|
and flagged as errors by Address Sanitizer. */
|
||||||
|
__extension__ struct d_saved_scope scopes[(dpi.num_saved_scopes > 0)
|
||||||
|
? dpi.num_saved_scopes : 1];
|
||||||
|
__extension__ struct d_print_template temps[(dpi.num_copy_templates > 0)
|
||||||
|
? dpi.num_copy_templates : 1];
|
||||||
|
|
||||||
dpi.saved_scopes = scopes;
|
dpi.saved_scopes = scopes;
|
||||||
dpi.copy_templates = temps;
|
dpi.copy_templates = temps;
|
||||||
|
|
Loading…
Add table
Reference in a new issue