Fix out-of-bounds read in FileSystemFilter::Cleanup

Fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33238
pull/4146/head
Alex Rebert 2021-10-29 09:17:40 -04:00
parent 6f07e89fdf
commit e900617796
No known key found for this signature in database
GPG Key ID: E082090D746F1A81
1 changed files with 3 additions and 2 deletions

View File

@ -300,13 +300,14 @@ private:
const char separator = getOsSeparator();
for (it = in.begin(); it != in.end(); ++it) {
int remaining = std::distance(in.end(), it);
// Exclude :// and \\, which remain untouched.
// https://sourceforge.net/tracker/?func=detail&aid=3031725&group_id=226462&atid=1067632
if ( !strncmp(&*it, "://", 3 )) {
if (remaining >= 3 && !strncmp(&*it, "://", 3 )) {
it += 3;
continue;
}
if (it == in.begin() && !strncmp(&*it, "\\\\", 2)) {
if (it == in.begin() && remaining >= 2 && !strncmp(&*it, "\\\\", 2)) {
it += 2;
continue;
}