Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3507

common-b64.c: comparison of unsigned value to -1

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.16.0
    • Component/s: Build
    • None
    • Environment:
      clang compiler, any platform

      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.

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            alb@neptunesystems.com Allan Bazinet
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: