Invalid regex causes panic in uap-go
veqryn opened this issue · comments
Chris Duncan commented
In the last day, the master regex list (as seen here: https://raw.githubusercontent.com/ua-parser/uap-core/master/regexes.yaml ) was updated to include a regex that causes uap-go to panic (crash).
An issue was opened in uap-go, but it was requested that an issue be opened here instead because the broken regex lives in this project: ua-parser/uap-go#66
panic: regexp: Compile(`Android \d+?(?:\.\d+|)(?:\.\d+|); ([^;]+?)(?: Build|\) AppleWebKit).+?(?<! Mobile) Safari`): error parsing regexp: invalid or unsupported Perl syntax: `(?<`
goroutine 1 [running]:
regexp.MustCompile(0xc0000277a0, 0x59, 0xc00095ebe0)
/usr/local/go/src/regexp/regexp.go:311 +0x152
github.com/ua-parser/uap-go/uaparser.compileRegex(0x0, 0x0, 0xc0000277a0, 0x59, 0xc00095ebe0)
...
I think it would also be helpful to add tests for parsing all regexes to this repo, in a variety of languages (PHP, Javascript, Python, Golang, etc).
commenthol commented
#455 was merged.
Chris Duncan commented
@commenthol can tests be added to this repo so that this doesn't happen again?
commenthol commented