[Mono-dev] IndexOutOfRangeException in UriTemplate.Match
David Curylo
curylod at asme.org
Sat Jan 31 03:47:32 UTC 2015
I ran into a small problem with UriTemplate on mono vs. .NET. The code below works on .NET, but raises an IndexOutOfRangeException on mono:
var uriTemplate = new System.UriTemplate("/{mystuff}/*", true);
uriTemplate.Match(new Uri("http://server"), new Uri("http://server/mystuff/path?blah"));
The problem is here: https://github.com/mono/mono/blob/master/mcs/class/System.ServiceModel.Web/System/UriTemplate.cs#L324
The query parameters are split on ‘=‘ but nothing checks that there are two values in the resulting array before trying to access the second element.
PR: https://github.com/mono/mono/pull/1542
Thanks.
More information about the Mono-devel-list
mailing list