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

Fix uninitialized bool in txn_ckpt.c

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • WT10.0.1, 4.4.8, 5.0.2, 5.1.0-rc0
    • None
    • 2
    • Storage - Ra 2021-06-28

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              jie.chen@mongodb.com Jie Chen
              tammy.bailey@mongodb.com Tammy Bailey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: