[Users] [PATCH 2/3] Do not allow search cost to explode in case of bad message parsing in textview_make_clickable_parts_later();
colin at colino.net
Thu Oct 25 12:24:20 CEST 2012
> Searching all patterns inside for(walk) loop in worst case could lead
> to an expontential like search cost if 'walk' is incremented by a
> character on each iteration. Rewriting pattern loop from inner to
> outer loop will fix issue and yeld only O(n) complexity.
Just FYI, this one caused issues with http://www.example.com links,
because two parsers match this (http:// and www.). That made two URIs.
I've fixed it by testing than the current match is not a sub-match of
the previous (prev->bp < cur->bp && prev->ep == cur->ep), see cvs107.
More information about the Users