Page MenuHomePhabricator

Fall back to slow UTF8 algorithms that don't crash
ClosedPublic

Authored by epriestley on Jun 11 2014, 2:02 PM.
Tags
None
Referenced Files
F12841159: D9472.id23141.diff
Thu, Mar 28, 8:59 PM
Unknown Object (File)
Sun, Mar 17, 9:27 PM
Unknown Object (File)
Fri, Mar 1, 3:39 AM
Unknown Object (File)
Tue, Feb 27, 11:15 PM
Unknown Object (File)
Feb 8 2024, 8:11 AM
Unknown Object (File)
Feb 8 2024, 5:39 AM
Unknown Object (File)
Feb 6 2024, 1:38 PM
Unknown Object (File)
Jan 7 2024, 4:47 AM

Details

Summary

Fixes T5316. PCRE can blow stacks on (x|y)+ regexps, and a user is hitting a consistent fatal in PCRE.

Rewrite the fallback for phutil_is_utf8() to be iterative. This is somewhat slower, but not normally too horrible, and we have a variety of ways to mitigate that if it arises as a real issue (encourage installation of mb extension, ship a fast C extension, etc).

We already have most of this code anyway.

Test Plan

We have fairly good test coverage here already, I mostly just realigned the existing test coverage to explicitly call the new code.

Diff Detail

Repository
rPHU libphutil
Branch
utf8slow
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 993
Build 993: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

epriestley retitled this revision from to Fall back to slow UTF8 algorithms that don't crash.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
  • Tweak an old, slightly misleading comment.

Tested and works for me on the changeset that was displaying this issue. It did prompt to mark 2 of the files in the diff as binary, but allowed the revision to be posted.

btrahan edited edge metadata.

You are much smarter than my baby.

This revision is now accepted and ready to land.Jun 20 2014, 5:19 PM
epriestley updated this revision to Diff 23141.

Closed by commit rPHUf1e0aedec85b (authored by @epriestley).