summaryrefslogtreecommitdiffstats
path: root/txr.1
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
commit77406d76ba836230a907cb3a2cdb9a5641b1fba8 (patch)
tree42acfa1b543e886a5bd3b90c3dd2deb9364a82d9 /txr.1
parenta58577fba180a08ebc0fcf43be8a99996359966f (diff)
downloadtxr-77406d76ba836230a907cb3a2cdb9a5641b1fba8.tar.gz
txr-77406d76ba836230a907cb3a2cdb9a5641b1fba8.tar.bz2
txr-77406d76ba836230a907cb3a2cdb9a5641b1fba8.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 'txr.1')
0 files changed, 0 insertions, 0 deletions