1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-24 21:48:21 +01:00
phorge-phorge/src/infrastructure/diff/prose
epriestley fcb75d0503 Fix an issue where prose diffing may fail after hitting the PCRE backtracking limit
Summary:
Fixes T13554. For certain prose diff inputs and PCRE backtracking limits, this regular expression may back track too often and fail.

A characteristic input is "x x x x ...", i.e. many sequences where `(.*?)\s*\z` looks like it may be able to match but actually can not.

I think writing an expression which has all the behavior we'd like without this backtracking issue isn't trivial (at least, I don't think I know how to do it offhand); just use a strategy based on "trim()" insetad, which avoids any PCRE complexities here.

Test Plan: Locally, this passes the "x x x ..." test which the previous code failed. I'm not including that test because it won't reproduce across values of "pcre.backtrac_limit", PCRE versions, etc.

Maniphest Tasks: T13554

Differential Revision: https://secure.phabricator.com/D21422
2020-07-23 07:46:15 -07:00
..
__tests__ Fix an issue where prose diffing may fail after hitting the PCRE backtracking limit 2020-07-23 07:46:15 -07:00
PhutilProseDiff.php Add "PhutilProseDiff" classes to "phabricator/" 2019-09-25 16:49:54 -07:00
PhutilProseDifferenceEngine.php Fix an issue where prose diffing may fail after hitting the PCRE backtracking limit 2020-07-23 07:46:15 -07:00