Skip to content


Subversion checkout URL

You can clone with
Download ZIP


URIUtils: fix out of range exception in resolvePath() #4321

merged 1 commit into from

5 participants


This fixes an out of range exception from

in the case where the content of path only consists of the delimiter character (e.g. the linux root path "/"). This has been reported in the forum:

Obviously Gotham material if accepted.


Iterators would be a better idea, no?


Yes but I wanted to change the code as little as possible. But I can do an iterator approach if that's ok.


Yes, I don't like path.size() being evaluated every iteration of the loop.


Agreed, iterators seem the better way to go here. In addition, delim appears to be a char masquerading as a string for no particular reason?


@jmarshallnz delim is sometimes used as a char with and sometimes as a string because std::string doesn't have a constructor that only takes a char.


I've updated the first commit to use an iterator. I've also added a second commit to cleanup the double-usage of delim as a std::string and a char. I'm happy to drop that commit if deemed unnecessary.


Ah, we don't have a version of Split() that takes a char. Everything else will be fine with the char though (including the appending?)


IMO it's not worth it in that case - mayaswell leave it as a string.


OK I've dropped the commit again.


jenkins build this please

@jmarshallnz jmarshallnz merged commit b6b5cee into xbmc:master

1 check failed

Details default Merged build #317 failed in 8 min 3 sec

Should I do a PR against Gotham or will someone cherry-pick the commit?

@MartijnKaijser MartijnKaijser added this to the H* 14.0-alpha1 milestone
@jmarshallnz jmarshallnz removed the Gotham label
@Montellese Montellese removed this from the Helix 14.0-alpha1 milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 xbmc/utils/URIUtils.cpp
6 xbmc/utils/URIUtils.cpp
@@ -1226,10 +1226,12 @@ std::string URIUtils::resolvePath(const std::string &path)
CStdString realPath;
int i = 0;
// re-add any / or \ at the beginning
- while ( ==
+ for (std::string::const_iterator itPath = path.begin(); itPath != path.end(); ++itPath)
+ if (*itPath !=
+ break;
realPath += delim;
- i++;
// put together the path
realPath += StringUtils::Join(realParts, delim);
Something went wrong with that request. Please try again.