Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-804

Use int64_t for timeouts consistently

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • libmongoc
    • None

    Description

      There are a number of places that timeouts are handled as signed 32-bit millisecond values. This invites overflows if the timeout is over 36 minutes:

      /* 36 minutes */
      int32_t timeout_msec = 2160000;
      /* overflow */
      int64_t expire_at = bson_get_time_monotonic () + timeout_msec * 1000;
      

      This particular bug can be fixed with:

      int64_t expire_at = bson_get_time_monotonic () + (int64_t) timeout_msec * 1000;
      

      ... until the next time we make the same mistake.

      Change all timeout_msec values to int64_t.

      Attachments

        Activity

          People

            jesse@mongodb.com A. Jesse Jiryu Davis
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: