[CDRIVER-3507] common-b64.c: comparison of unsigned value to -1 Created: 28/Jan/20  Updated: 29/Jan/20  Resolved: 29/Jan/20

Status: Closed
Project: C Driver
Component/s: Build
Affects Version/s: 1.16.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Allan Bazinet Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

clang compiler, any platform



 Description   

Lines 288-290 of mongo-c-driver-1.16.0/src/common/common-b64.c:

 

for (i = 1; i < 256; ++i) {

  ch = (unsigned char) i;
  /* Whitespaces */
  if (ch >= -1 && ch <= 255 && isspace (ch))

ch is unsigned; it's never not going to be greater than or equal to -1. Further, you're iterating in a loop from 1 to 255 in the first place; not sure where a -1 is going to sneak in there, frankly.

 



 Comments   
Comment by Kevin Albertson [ 29/Jan/20 ]

Thanks for the report alb@neptunesystems.com. This will be fixed in 1.16.1 under the ticket CDRIVER-3489.

Generated at Wed Feb 07 21:18:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.