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

Fix undefined behavior in verbose output

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 3.6.3, 3.7.1, WT3.1.0
    • None
    • None
    • Storage 2017-12-18

    Description

      This code to dump the cache state in evict_lru.c has undefined behavior:

              WT_RET(__wt_msg(session, "cache clean check: %s (%u%%)",
                  __wt_eviction_clean_needed(session, &pct) ? "yes" : "no", pct));
      

      In particular, it expects that the function setting pct completes before the value of pct is passed to __wt_msg.

      It would be better as:

              needed = __wt_eviction_clean_needed(session, &pct);
              WT_RET(__wt_msg(session, "cache clean check: %s (%u%%)",
                  needed ? "yes" : "no", pct));
      

      Review the code for similar issues.

      Attachments

        Activity

          People

            keith.bostic@mongodb.com Keith Bostic (Inactive)
            michael.cahill@mongodb.com Michael Cahill
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: