si_names access one past the end.
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 9 May 2014 22:49:25 +0000 (18:49 -0400)
committerTony Cook <tony@develop-help.com>
Thu, 29 May 2014 06:43:42 +0000 (16:43 +1000)
Fix for Coverity perl5 CID 45359.

deb.c

diff --git a/deb.c b/deb.c
index bccfc18..d16103e 100644 (file)
--- a/deb.c
+++ b/deb.c
@@ -217,7 +217,9 @@ Perl_deb_stack_all(pTHX)
     for (;;)
     {
         const size_t si_name_ix = si->si_type+1; /* -1 is a valid index */
-        const char * const si_name = (si_name_ix >= sizeof(si_names)) ? "????" : si_names[si_name_ix];
+        const char * const si_name =
+            si_name_ix < C_ARRAY_LENGTH(si_names) ?
+            si_names[si_name_ix] : "????";
        I32 ix;
        PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n",
                                                (IV)si_ix, si_name);