void* MemoryMappedFile::map(....) {
....
size_t len = strlen(filename);
for (size_t i = len - 1; i >= 0; i--) { // <=
if (filename[i] == '/' || filename[i] == '\\')
break;
if (filename[i] == ':')
filename[i] = '_';
}
....
}
A link to the source code on GitHub
PVS-Studio warning: V547 Expression 'i >= 0' is always true. Unsigned type value is always >= 0. mmap_windows.cpp 197
The conditional statement of the loop (i >= 0) should always be true, as the loop counter ( i ) is of unsigned type (size_t).
This issue was originally reported in SERVER-28570.
- is duplicated by
-
SERVER-28570 Analysis of 'MongoDB' source code by PVS-Studio
-
- Closed
-