aloneguid / bt

Browser Tamer
https://aloneguid.github.io/bt/
Apache License 2.0
134 stars 6 forks source link

regex with alternation ("|") in patten causes crashes #59

Closed egerlach closed 5 months ago

egerlach commented 7 months ago

Regex rules that contain a pipe character for doing regex alternation cause a crash. For example, I have the following rule to handle certain Zoom URLs:

rule = type:regex|.*zoom.us/(join|my|j).*

The problem appears to originate from https://github.com/aloneguid/bt/blob/master/bt/app/match_rule.cpp#L21 where the rule is split on "|" indiscriminately. The machine I'm on isn't set up for development, otherwise I would try to put a fix together. As a workaround, I've created multiple rules so this isn't urgent.

aloneguid commented 7 months ago

Oh thanks, it's 2023 and i still forge to escape strings. Back to the drawing board.

egerlach commented 7 months ago

I hear ya, parsing is hard. Thanks for being an awesome maintainer!

aloneguid commented 5 months ago

This seems to be fixed, scheduling for next release. If you'd like to test it early please download "bin" artifact from https://github.com/aloneguid/bt/actions/runs/7714781148

aloneguid commented 5 months ago

this is now released in 3.7.0