do_op_dump(): handle unknown op_private enums blead
authorDavid Mitchell <davem@iabyn.com>
Thu, 26 Feb 2015 15:44:04 +0000 (15:44 +0000)
committerDavid Mitchell <davem@iabyn.com>
Thu, 26 Feb 2015 15:44:04 +0000 (15:44 +0000)
Where a bitfield value in op_private doesn't correspond to any enums,
do_op_dump() is supposed to display the value as an integer (with
optional LABEL= prefix). Concise does this, do_op_dump was failing to
do this, and instead trying to display the value symbolically as string at
offset -1 in PL_op_private_labels.

This wasn't important yet as no ops currently have an unspecified enum
value.

Spotted by Coverity.

dump.c

index 9587668..8d2f95b 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -905,7 +905,10 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
                         sv_catpv(tmpsv, &PL_op_private_labels[label]);
                         sv_catpv(tmpsv, "=");
                     }
-                    sv_catpv(tmpsv, &PL_op_private_labels[enum_label]);
+                    if (enum_label == -1)
+                        Perl_sv_catpvf(aTHX_ tmpsv, "0x%"UVxf, (UV)val);
+                    else
+                        sv_catpv(tmpsv, &PL_op_private_labels[enum_label]);
 
                 }
                 else {