diff options
author | David Mitchell <davem@iabyn.com> | 2017-02-27 13:15:31 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2017-02-27 13:15:31 +0000 |
commit | f49e84642c2886177a0ec4ddff2ef186df4c6441 (patch) | |
tree | 0c3ba845a0dbe8b0dd7647da54260770cc949106 /dump.c | |
parent | 41b1e858a075694f88057b9514f5fc78c80b5355 (diff) | |
download | perl-f49e84642c2886177a0ec4ddff2ef186df4c6441.tar.gz |
S_do_op_dump_bar(): don't print TRANS op_pv field
My recent commit v5.25.9-32-gabd07ec made dump.c display the op_pv
string of OP_NEXT, OP_TRANS etc ops. However, for OP_TRANS/OP_TRANSR,
the string is basically a 256-byte potentially non null-temrinated array.
This was causing a buffer read overrun and garbage to be displayed.
The simple solution is to only display the address but not contents
for a trans op. OP_NEXT ec labels continue to be displayed.
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1227,21 +1227,22 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o) case OP_REDO: if (o->op_flags & (OPf_SPECIAL|OPf_STACKED|OPf_KIDS)) break; - /* FALLTHROUGH */ - case OP_TRANS: - case OP_TRANSR: - if ( (o->op_type == OP_TRANS || o->op_type == OP_TRANSR) - && (o->op_private & (OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF))) - break; - { SV * const label = newSVpvs_flags("", SVs_TEMP); generic_pv_escape(label, cPVOPo->op_pv, strlen(cPVOPo->op_pv), 0); S_opdump_indent(aTHX_ o, level, bar, file, "PV = \"%" SVf "\" (0x%" UVxf ")\n", SVfARG(label), PTR2UV(cPVOPo->op_pv)); + break; } + case OP_TRANS: + case OP_TRANSR: + S_opdump_indent(aTHX_ o, level, bar, file, + "PV = 0x%" UVxf "\n", + PTR2UV(cPVOPo->op_pv)); + break; + default: break; |