This is an archive of the discontinued LLVM Phabricator instance.

[libcxx, regex] Throw exception after too many steps.
ClosedPublic

Authored by timshen on Jan 2 2017, 10:19 PM.

Details

Summary

This prevents the backtracking regex engines from "hanging forever"
under certain input.

Event Timeline

timshen updated this revision to Diff 82839.Jan 2 2017, 10:19 PM
timshen retitled this revision from to [libcxx, regex] Throw exception after too many steps..
timshen updated this object.
timshen added a reviewer: mclow.lists.
timshen added a subscriber: cfe-commits.
timshen updated this revision to Diff 82840.Jan 2 2017, 10:23 PM
timshen edited edge metadata.

Detect user defined _LIBCPP_REGEX_COMPLEXITY_FACTOR first.

I defined and exported a macro _LIBCPP_REGEX_COMPLEXITY_FACTOR in the hope that even when the library is shipped to the user, and when the user finds the factor to be inappropriate, they can override it.

I'm not aware of and exported macro policy though, please advice. :)

mclow.lists accepted this revision.Sep 12 2017, 10:59 AM

Applied as revision 313056 (with minor editing)

This revision is now accepted and ready to land.Sep 12 2017, 10:59 AM
mclow.lists closed this revision.Sep 12 2017, 10:59 AM