mirror of https://github.com/kiwix/libkiwix.git
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:
parent
5182a66b19
commit
940818d801
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue