1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 00:02:41 +01:00
phorge-phorge/src/applications/differential/parser
epriestley 10966519e2 Prevent "commit message magic words" parser from exploding on "reverts aaaa.....aaz"
Summary:
Fixes T9268. Currently, we try to match any string like "a2f313f1" as a commit/revision, so short hashes will get picked up.

However, we don't require a word boundary or terminal after the match, so for input like "aaa...aaaaz" the engine can get stuck trying to split the string into sub-matches.

That is, in the original case, the input "aaaz" had valid matches against `[rA-Z0-9a-f]+` up to "z" of:

  aaa
  aa a
  a aa
  a a a

All of these will fail once it hits "z", but it has to try them all. This complexity is explosive with longer strings.

Instead, require a word boundary or EOL after the match, so this is the only valid match:

  aaa

Then the engine sees the "z", says "nope, no match" and doesn't have to backtrack across all possible combinations.

Test Plan: Added a failing unit test, applied patch, clean test.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9268

Differential Revision: https://secure.phabricator.com/D13997
2015-08-26 09:35:23 -07:00
..
__tests__ Prevent "commit message magic words" parser from exploding on "reverts aaaa.....aaz" 2015-08-26 09:35:23 -07:00
DifferentialChangesetParser.php Return $this from setter methods 2015-07-06 22:53:43 +10:00
DifferentialCommitMessageParser.php Extend from Phobject 2015-06-15 18:02:27 +10:00
DifferentialCustomFieldDependsOnParser.php Clean up various pieces of dead/obsolete Differential code 2014-03-11 13:02:19 -07:00
DifferentialCustomFieldRevertsParser.php Clean up various pieces of dead/obsolete Differential code 2014-03-11 13:02:19 -07:00
DifferentialHunkParser.php Various linter fixes 2015-08-11 22:36:55 +10:00
DifferentialLineAdjustmentMap.php Implement rough content-aware inline adjustment rules for ghosts 2015-05-07 14:09:41 -07:00