Skip to content

Commit 76f02b3

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 e4bcc78 commit 76f02b3

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
@@ -2797,9 +2797,9 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
27972797
PTR2UV(CvSTART(sv)));
27982798
else
27992799
Perl_dump_indent(aTHX_ level, file,
2800-
" START = 0x%" UVxf " ===> %" IVdf "\n",
2800+
" START = 0x%" UVxf " ===> %" UVuf "\n",
28012801
PTR2UV(CvSTART(sv)),
2802-
(IV)sequence_num(CvSTART(sv)));
2802+
sequence_num(CvSTART(sv)));
28032803
}
28042804
Perl_dump_indent(aTHX_ level, file, " ROOT = 0x%" UVxf "\n",
28052805
PTR2UV(CvROOT(sv)));

0 commit comments

Comments
 (0)