Operational Defect Database

BugZero found this defect 2496 days ago.

MongoDB | 378279

[SERVER-29003] Expression 'i >= 0' is always true. Unsigned type value is always >= 0. mmap_windows.cpp 197

Last update date:

10/30/2023

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

3.5.9

Description:

Info

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.

Top User Comments

xgen-internal-githook commented on Thu, 8 Jun 2017 15:13:52 +0000: Author: {u'name': u'Kim Tao', u'email': u'kim.tao@mongodb.com'} Message: SERVER-29003 Fix unsigned int warning Branch: master https://github.com/mongodb/mongo/commit/6f7fd7318d61bd145bb75a9a0a5d35387d2a6b9f

Additional Resources / Links

Share:

BugZero Risk Score

Coming soon

Status

Closed

Have you been affected by this bug?

cost-cta-background

Do you know how much operational outages are costing you?

Understand the cost to your business and how BugZero can help you reduce those costs.

Discussion

Login to read and write comments.

Have you ever...

had your data corrupted from a

VMware

bug?

Search:

...