Page MenuHomePhabricator

Limit remarkup URI protocol length to 32 characters to avoid expensive regex behavior
ClosedPublic

Authored by epriestley on Wed, Feb 17, 9:12 PM.

Details

Summary

Ref T13608. When searching for bare URIs in remarkup text, don't look for URIs with a protocol string longer than 32 characters.

This avoids a case where the regexp engine may be tricked into executing at O(N^2) or some similar complexity.

Test Plan
  • Applied remarkup to "AAAA..." (512KB).
  • Before: 64 seconds to process.
  • After: <10ms to process.
  • Ran unit tests.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.