adblock slow on .*.*.*. rule

Bug #1305837 reported by Andrey Zholos
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Midori Web Browser
Fix Released
High
Unassigned

Bug Description

Since updating to Midori 0.5.8, the browser hangs for several seconds when
opening any page.

I noticed this warning (it doesn't always appear):
WARNING **: subscriptions.vala:388: Adblock match error: Error while matching regular expression ..*..*..*.info/: backtracking limit reached

And found the corresponding rule in the filter list:
https://ruadlist.googlecode.com/hg/advblock.txt
.*.*.*.info/$popup

I think those dots should be escaped when building the regular expression.

This change to fixup_regex fixed the problem for me:

--- extensions/adblock/extension.vala
+++ extensions/adblock/extension.vala
@@ -464,6 +464,7 @@
                 case '?':
                 case '[':
                 case ']':
+ case '.':
                     fixed.append_printf ("\\%c", c); break;
                 default:
                     fixed.append_c (c); break;

This problem didn't seem to occur in previous versions of Midori, even though
the C version of fixup_regex also didn't escape dots. I'm not sure why that is.

Related branches

Cris Dywan (kalikiana)
Changed in midori:
milestone: none → 0.5.11
Cris Dywan (kalikiana)
Changed in midori:
status: New → Confirmed
importance: Undecided → High
RabbitBot (rabbitbot-a)
Changed in midori:
status: Confirmed → Fix Committed
Cris Dywan (kalikiana)
Changed in midori:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.