htonl missing for rb_object_id_generator_next when time == NULL

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 2.0.0
    • Affects Version/s: None
    • Component/s: BSON, C Extensions
    • None
    • None
    • Major Change
    • None
    • None
    • None
    • None
    • None
    • None

      In native.c method: rb_object_id_generator_next, when time is NULL, we use rb_current_time_milliseconds() but this should be

      if (argc == 0 || (argc == 1 && *time == Qnil)) {
        t = htonl(rb_current_time_in_milliseconds());  /* This line needs to be changed. */
      else {
        t = htonl(NUM2UINT(rb_funcall(*time, rb_intern("to_i"), 0)));
      }
      

      When time is passed, its correctly doing a htonl(). Making this change, ensures that object_ids will be generated in ascending order.

              Assignee:
              Durran Jordan
              Reporter:
              Gautam Rege
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: