Skip to content

Commit d7c5601

Browse files
committed
don't quite fix potential I32 overflow in S_run_user_filter
Coverity says: CID 584101: Integer handling issues (INTEGER_OVERFLOW) Expression "status", where "Perl_SvIV(my_perl, out)" is known to be equal to 0, overflows the type of "status", which is type "int". What it really means is that doing 'int status = SvIV(...)' may overflow (since IV can be (and on 64-bit systems usually is) wider than int). This patch doesn't fix that issue. However, it avoids yet another type in the mix: S_run_user_filter() is declared as returning I32, not int, and elsewhere assigns filter_read(...) (also an I32) to 'result'. So instead of worrying about (overflowing) conversions between IV, int, and I32, make 'result' an I32 and only worry about (overflowing) conversions between IV and I32.
1 parent 137855d commit d7c5601

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pp_ctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6852,7 +6852,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
68526852
const int filter_has_file = IoLINES(datasv);
68536853
SV * const filter_state = MUTABLE_SV(IoTOP_GV(datasv));
68546854
SV * const filter_sub = MUTABLE_SV(IoBOTTOM_GV(datasv));
6855-
int status = 0;
6855+
I32 status = 0;
68566856
SV *upstream;
68576857
STRLEN got_len;
68586858
char *got_p = NULL;

0 commit comments

Comments
 (0)