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)
Sun, Dec 15, 11:04 AM
Unknown Object (File)
Sun, Dec 1, 12:40 PM
Unknown Object (File)
Sun, Dec 1, 12:40 PM
Unknown Object (File)
Sun, Dec 1, 12:40 PM
Unknown Object (File)
Sun, Dec 1, 12:40 PM
Unknown Object (File)
Sat, Nov 30, 6:39 PM
Unknown Object (File)
Sat, Nov 23, 9:21 PM
Unknown Object (File)
Sat, Nov 23, 7:44 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
Branch
remarkup1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25141
Build 34696: Run Core Tests
Build 34695: arc lint + arc unit