Homec4science

Fall back to slow UTF8 algorithms that don't crash

Authored by epriestley <git@epriestley.com> on Jun 20 2014, 20:48.

Description

Fall back to slow UTF8 algorithms that don't crash

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.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: webframp, epriestley

Maniphest Tasks: T5316

Differential Revision: https://secure.phabricator.com/D9472

Details

Committed
epriestley <git@epriestley.com>Jun 20 2014, 20:48
Pushed
aubortMar 17 2017, 12:03
Parents
rPHUe0fd683ec58a: Provide more flexible string truncation in libphutil
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHUf1e0aedec85b: Fall back to slow UTF8 algorithms that don't crash (authored by epriestley <git@epriestley.com>).Jun 20 2014, 20:48