Skip to content

Commit cefd2df

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

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
@@ -6855,7 +6855,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
68556855
const int filter_has_file = IoLINES(datasv);
68566856
SV * const filter_state = MUTABLE_SV(IoTOP_GV(datasv));
68576857
SV * const filter_sub = MUTABLE_SV(IoBOTTOM_GV(datasv));
6858-
int status = 0;
6858+
I32 status = 0;
68596859
SV *upstream;
68606860
STRLEN got_len;
68616861
char *got_p = NULL;

0 commit comments

Comments
 (0)