-
Notifications
You must be signed in to change notification settings - Fork 10
Version 3.1.2 chokes (fails hard) on parsing real-world user agent that previous versions could parse successfully #95
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Thanks for building and maintaining this great library! I upgraded to the latest release and found an issue parsing some
Repro code:
HttpUserAgentParser.Parse("Mozilla/5.0 (Linux; U; Android 13; Infinix X6836 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/145.0.7632.120 Mobile Safari/537.36 OPR/98.0.2254.81553");
On 3.1.2, this fails with:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at MyCSharp.HttpUserAgentParser.HttpUserAgentParser.GetBrowser(String userAgent) in /home/runner/work/HttpUserAgentParser/HttpUserAgentParser/src/HttpUserAgentParser/HttpUserAgentParser.cs:line 108
at MyCSharp.HttpUserAgentParser.HttpUserAgentParser.Parse(String userAgent) in /home/runner/work/HttpUserAgentParser/HttpUserAgentParser/src/HttpUserAgentParser/HttpUserAgentParser.cs:line 30
On 3.0.28, this works and gives us MobileDeviceType: Android, Name: Opera, Platform: Android, Version: 98.0.2254.81553
Other examples that fail on 3.1.2 but not 3.0.28:
Mozilla/5.0 (Linux; U; Android 13; Hisense U53 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/145.0.7632.79 Mobile Safari/537.36 OPR/98.0.2254.81553Mozilla/5.0 (Linux; Android 10; MED-LX9) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.5481.192 Mobile Safari/537.36 OPR/74.0.3922.71152Mozilla/5.0 (Linux; U; Android 13; Infinix X6526 Build/TP1A.220624.014; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/145.0.7632.79 Mobile Safari/537.36 OPR/97.1.2254.80849
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working