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

Fix overflowed value in Btree atomic flags of 8 bit type

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 5.2.0, 5.0.20
    • Affects Version/s: None
    • Component/s: None
    • None
    • 5
    • Storage - Ra 2021-11-15

      Here is the coverity link: https://coverity.corp.mongodb.com/reports.htm#v17018/p10049/fileInstanceId=38657649&defectInstanceId=20178721&mergedDefectId=121029&eventId=20178721-0

      In bt_split.c:

      1614    if (ref != NULL) {
      1615        if (ref->page != NULL)    
      CID 121029 (#1 of 1): Bitwise-and with zero (CONSTANT_EXPRESSION_RESULT)bit_and_with_zero: ref->page->flags_atomic & 0 /* (uint8_t)256U */ is always 0. This occurs as the logical operand of if.
      1616            F_SET_ATOMIC(ref->page, WT_PAGE_UPDATE_IGNORE);
      1617        __wt_free_ref(session, ref, orig->type, true);
      1618    } 

      The problem is that F_SET_ATOMIC is set up to work on uint8_t data type, and WT_PAGE_UPDATE_IGNORE is 0x100, which doesn't fit into 8 bits.

        1. overflow.diff
          6 kB
        2. flags.diff
          2 kB

            Assignee:
            ravi.giri@mongodb.com Ravi Giri
            Reporter:
            donald.anderson@mongodb.com Donald Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: