Do not do iterator underflow in urlDecode

`value.end() - 3` may be "before start of string" if string length is < 3.
On Windows debug, is throw an exception.
On other platform it is probably an undefined behavior.

Rewrite the test to avoid such invalid substraction.
This commit is contained in:
Matthieu Gautier 2024-08-22 14:37:23 +02:00
parent 5182a66b19
commit 940818d801
1 changed files with 1 additions and 1 deletions

View File

@ -257,7 +257,7 @@ std::string kiwix::urlDecode(const std::string& value, bool component)
// If there aren't enough characters left for this to be a
// valid escape code, just use the character and move on
if (it > value.end() - 3) {
if (value.end() - it < 3) {
os << *it;
continue;
}