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

Fix undefined behavior in verbose output

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6.3, 3.7.1, WT3.1.0
    • Component/s: None
    • Labels:
      None
    • Sprint:
      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

            Assignee:
            keith.bostic Keith Bostic
            Reporter:
            michael.cahill Michael Cahill
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: