Skip to content

Commit 137855d

Browse files
committed
fix potential IV overflow in do_sv_dump()
Coverity says: CID 584102: Insecure data handling (INTEGER_OVERFLOW) The cast of "S_sequence_num(my_perl, ((XPVCV *)({...; p_;}))->xcv_start_u.xcv_start)" to a signed type could result in a negative number. Avoid the issue by taking the UV returned by sequence_num and printing it directly (without going through IV conversion).
1 parent bcdfea7 commit 137855d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2765,9 +2765,9 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
27652765
PTR2UV(CvSTART(sv)));
27662766
else
27672767
Perl_dump_indent(aTHX_ level, file,
2768-
" START = 0x%" UVxf " ===> %" IVdf "\n",
2768+
" START = 0x%" UVxf " ===> %" UVuf "\n",
27692769
PTR2UV(CvSTART(sv)),
2770-
(IV)sequence_num(CvSTART(sv)));
2770+
sequence_num(CvSTART(sv)));
27712771
}
27722772
Perl_dump_indent(aTHX_ level, file, " ROOT = 0x%" UVxf "\n",
27732773
PTR2UV(CvROOT(sv)));

0 commit comments

Comments
 (0)