[Python-ideas] Updated PEP 428 (pathlib)

Devin Jeanpierre jeanpierreda at gmail.com
Wed Mar 6 21:01:27 CET 2013


On Wed, Mar 6, 2013 at 2:21 PM, Charles-François Natali
<cf.natali at gmail.com> wrote:
>>> Now, the question is whether we want to try to mitigate this or not...
>>>
>> It's not something I've ever used, but it doesn't look that difficult
>> compared to regex if all it has is "*", "?", "[...]" and "[!...]".
>
> What's not difficult?
> Avoiding DoS with arbitrary glob patterns?
>
> If yes, please share your idea :-)

Compile the glob pattern to an NFA and simulate the NFA efficiently
(using Thompson's algorithm or even backtracking with memoization,
rather than plain backtracking).

For example, see: http://swtch.com/~rsc/regexp/regexp1.html

-- Devin



More information about the Python-ideas mailing list