summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-25 23:10:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-25 23:10:38 -0700
commitdb1f7111a17b64a24bb30d10f192a1e9951b9587 (patch)
tree42acfa1b543e886a5bd3b90c3dd2deb9364a82d9 /eval.c
parent43d519c91ca21791e4f395f87522edcde8e933dc (diff)
downloadtxr-db1f7111a17b64a24bb30d10f192a1e9951b9587.tar.gz
txr-db1f7111a17b64a24bb30d10f192a1e9951b9587.tar.bz2
txr-db1f7111a17b64a24bb30d10f192a1e9951b9587.zip
Flurry of regex bugfixes.
* regex.c (match_regex): Bail if pos is too positive, beyond length of string. (match_regex_right): Include the pos == end case in the iteration, so we can match an empty suffix of the string. The inner loop guard takes care of not feeding any characters from the string into the regex machine in this case; we just feed the terminating zero to get the final state. (match_regst): Normalize a negative pos, otherwise the sub_str calculation will be junk, since match_regex returns a normalized position. After normalizing, check that if the position is still negative, the match must fail. (match_regst_right_old, match_regst_right): Use zero rather than t as the range end in sub_str. That way if len is zero and neg(len) produces zero, an empty string will be sliced out. For negative values, the zero serves as one position beyond the last char, just like t. (do_match_full_offs, regex_match_full, regex_range_full, regex_range_left): Fail match if normalized starting pos is negative. (regex_range_right): Fix completely bogus calculation of the returne range in the case when the end position defaults to the string length.
Diffstat (limited to 'eval.c')
0 files changed, 0 insertions, 0 deletions