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
F15469841: D21562.diff
Fri, Apr 4, 5:05 PM
F15459322: D21562.id.diff
Mon, Mar 31, 11:55 AM
F15455444: D21562.diff
Sun, Mar 30, 12:25 AM
F15452980: D21562.id51331.diff
Sat, Mar 29, 8:33 AM
F15452903: D21562.id51332.diff
Sat, Mar 29, 8:04 AM
F15449278: D21562.id.diff
Fri, Mar 28, 9:15 AM
F15446751: D21562.diff
Thu, Mar 27, 8:02 PM
F15435330: D21562.id51331.diff
Tue, Mar 25, 7:49 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
Branch
remarkup1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 25141
Build 34696: Run Core Tests
Build 34695: arc lint + arc unit