Fix uninitialized bool in txn_ckpt.c

XMLWordPrintableJSON

    • Storage Engines
    • Storage - Ra 2021-06-28
    • 2

      When implementing new build variants for UBSAN in WT-7552, a number of errors of the following signature were detected in src/txn/txn_ckpt.c:

      [2021/06/22 03:38:04.299] ../src/txn/txn_ckpt.c:1547:5: runtime error: load of value 127, which is not a valid value for type 'bool'

      The offending line is as follows:

      WT_UNUSED(seen_ckpt_add); 

      The reason for this error is that an uninitialized bool will have an indeterminate value, which is undefined behavior. The seen_ckpt_add variable is not initialized until late in the function and there are code paths that would skip this initialization completely. Moving the variable initialization to earlier in the function would prevent this sanitizer error.

            Assignee:
            Jie Chen
            Reporter:
            Tammy Bailey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: