Page MenuHomePhabricator

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

Authored by epriestley on Feb 17 2021, 9:12 PM.
Tags
None
Referenced Files
F13177736: D21562.diff
Wed, May 8, 7:55 PM
Unknown Object (File)
Tue, May 7, 3:16 AM
Unknown Object (File)
Mon, May 6, 4:55 PM
Unknown Object (File)
Fri, May 3, 10:23 PM
Unknown Object (File)
Mon, Apr 29, 4:31 PM
Unknown Object (File)
Thu, Apr 25, 12:10 AM
Unknown Object (File)
Sat, Apr 20, 5:34 PM
Unknown Object (File)
Thu, Apr 11, 8:27 AM
Subscribers
None

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
Lint Not Applicable
Unit
Tests Not Applicable