Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2691

Use wrappers for ctype functions to avoid sign extension errors

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • WT2.9.0, 3.3.9
    • Affects Version/s: None
    • Component/s: None
    • None

      WT-2677 chased a problem where a 'char' declaration is interpreted as signed on some platforms (like Solaris), but is unsigned on others. The signed interpretation did a sign extension of a char argument to give an invalid input to isprint(), which was undetected on the other platforms. This seems somewhat dangerous. There are only a handful of places where a char (without an explicit signed/unsigned) is used in WT. If we removed these and enforced this policy, errors of this nature would be reduced.

      It seems unlikely we could entirely remove the problem, consider:

      void foo(const char *p)

      Unknown macro: { return (isprint(*p)); }

      Getting rid of char * would be impossible.

            Assignee:
            donald.anderson@mongodb.com Donald Anderson
            Reporter:
            donald.anderson@mongodb.com Donald Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: