[Patch 2/3] Make regex's infinite loop detection accurate

Jonathan Wakely jwakely@redhat.com
Sun Apr 27 12:28:00 GMT 2014


On 26/04/14 22:34 -0400, Tim Shen wrote:
>On Sat, Apr 26, 2014 at 1:00 PM, Jonathan Wakely <jwakely@redhat.com> wrote:
>> Maybe a dumb question (I don't understand a lot of the regex code!)
>> but is it correct to set this to 1 in the case where
>> __rep_count.first != _M_current ?  Could that result in the count
>> going downwards from 2 to 1? (Maybe that's correct?)
>
>As I said in the comment, __rep_count records how many times
>(__rep_count.second) this node is visited *under certain input
>iterator* (__rep_count.first).
>
>That is to say, if the current iterator (_M_current) is not changing,
>but the executor keeps visiting this node, times of visit needs to be
>recorded. Once the _M_current changed, the count should be reset to 0.
>We simply set it to 1 for the "set to 0 then increase by 1"
>operations.

Oh of course, that makes perfect sense now, thanks!

This patch is OK to commit.

>About the overall regex code, I think I can compose a blog entry to
>explain it, if necessary?

If you do have time to do that it would be fantastic, I'm sure I
wouldn't be the only person who would find it valuable.



More information about the Libstdc++ mailing list