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

Change minutes to uint64 to avoid overflow in __wt_gen_drain

    • 1
    • Storage - Ra 2022-04-18

      (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.

            clarisse.cheah@mongodb.com Clarisse Cheah
            will.korteland@mongodb.com Will Korteland
            0 Vote for this issue
            2 Start watching this issue