This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
study_chunk: temporary underflow guard for scan_commit 17744/head
authorHugo van der Sanden <hv@crypt.org>
Thu, 23 Apr 2020 13:33:55 +0000 (14:33 +0100)
committerHugo van der Sanden <hv@crypt.org>
Thu, 23 Apr 2020 16:02:47 +0000 (17:02 +0100)
Numeric underflow on max_offset was being silently converted to
OPTIMIZE_INFTY by a misleading test. That test was removed in f6231ebfc0,
exposing multiple issues.

This restores the test in a more direct form for 5.32; it should
be removed after 5.32 is released so we can continue the search for
the underlying issues.

regcomp.c

index 097094c..ee9a2d2 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -1498,6 +1498,8 @@ S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, scan_data_t *data,
                        ? OPTIMIZE_INFTY
                        : (l
                           ? data->last_start_max
+                          /* temporary underflow guard for 5.32 */
+                          : data->pos_delta < 0 ? OPTIMIZE_INFTY
                           : (data->pos_delta > OPTIMIZE_INFTY - data->pos_min
                                         ? OPTIMIZE_INFTY
                                         : data->pos_min + data->pos_delta));