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

Change minutes to uint64 to avoid overflow in __wt_gen_drain

    XMLWordPrintable

Details

    • 1
    • Storage - Ra 2022-04-18

    Description

      (CID 122000) There's potential for an integer overflow bug when calculating the time diff when waiting for generation drain. The comparison time_diff_ms > minutes * WT_MINUTE * WT_THOUSAND has a uint64 on the left, and a uint32 on the right. So, the RHS will overflow if minutes is ever greater than 71582. That's 49 straight days of generation drain - if that ever happens, there are likely other problems, but we should still fix it. There's a WT_ASSERT that minutes < 4, but we won't see that in a release build.

      We can fix this by casting anything on the RHS to a uint64.

      Attachments

        Issue Links

          Activity

            People

              clarisse.cheah@mongodb.com Clarisse Cheah
              will.korteland@mongodb.com Will Korteland
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: