DistillNET
DistillNET copied to clipboard
IndexOutOfRangeException when parsing some rules
Hi,
I've noticed that the AbpFormatRuleParser.ParseAbpFormattedRule API is throwing an IndexOutOfRangeException when parsing some rules.
In particular, I've noticed the crash when parsing this line from the EasyList Privacy ruleset (https://easylist.to/easylist/easyprivacy.txt):
@@||adobedtm.com^*/satelliteLib-$script,domain=|absa.co.za|argos.co.uk|collegeboard.org|crackle.com|crimewatchdaily.com|directline.com|fcbarcelona.com|jeep.com|laredoute.co.uk|laredoute.com|lenovo.com|lowes.com|mastercard.us|mathworks.com|monoprice.com|nbcnews.com|newyorker.com|oprah.com|pnc.com|realtor.com|redbull.tv|repco.co.nz|searspartsdirect.com|smooth.com.au|sonycrackle.com|stuff.co.nz|subaru.com|timewarnercable.com|trip-planner.australia.com|vanityfair.com|wired.com
I can work around it by using a try/catch block around all the calls to ParseAbpFormattedRule for now, although that's not ideal as it introduces some overhead.
Hope this helps, keep up the good work! 😊
EDIT: on second thought, I think I'll keep the try/catch block in place just to be extra sure, so that I won't get any crashes even if the ruleset changed in the future. Still though, it might be a good idea to have the lib properly handle at least this particular case, now that we've found it.
Thanks for reporting. I'll get to this next week.