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
Unknown Object (File)
Tue, Nov 19, 12:00 AM
Unknown Object (File)
Mon, Nov 11, 12:47 PM
Unknown Object (File)
Tue, Oct 29, 6:36 PM
Unknown Object (File)
Sun, Oct 27, 3:49 PM
Unknown Object (File)
Sun, Oct 27, 12:10 PM
Unknown Object (File)
Wed, Oct 23, 12:55 AM
Unknown Object (File)
Oct 9 2024, 4:14 PM
Unknown Object (File)
Oct 9 2024, 4:14 PM

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
Lint
Lint Skipped
Unit
Tests Skipped

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).