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

Fix undefined behavior in verbose output

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.6.3, 3.7.1, WT3.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage 2017-12-18

      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.

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

              Created:
              Updated:
              Resolved: