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
Unknown Object (File)
Jun 30 2026, 12:15 PM
Unknown Object (File)
Jun 27 2026, 8:12 AM
Unknown Object (File)
Apr 15 2026, 11:37 AM
Unknown Object (File)
Mar 29 2026, 7:51 AM
Unknown Object (File)
Mar 18 2026, 8:36 PM
Unknown Object (File)
Mar 14 2026, 8:30 AM
Unknown Object (File)
Mar 13 2026, 8:09 AM
Unknown Object (File)
Dec 22 2025, 8:48 PM
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