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

Use wrappers for ctype functions to avoid sign extension errors

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.9.0, 3.3.9
    • Labels:
      None

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: