Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11135

BSONObjBuilder.appendNumber(numeric_limits<long long>::min()) results in 0 value

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.4
    • Component/s: Internal Code, Write Ops
    • Labels:
      None
    • Operating System:
      ALL

      Description

      Adding this to jsobjtests.cpp shows the error.

              class AppendNumberLongMin {
              public:
                  void run() {
                      BSONObjBuilder b;
                      b.appendNumber("a", std::numeric_limits<long long>::min());
                      BSONObj o1 = b.obj();
       
                      BSONObj o2 = BSON("a" << std::numeric_limits<long long>::min());
       
                      ASSERT_EQUALS(o1, o2);
                  }
              };

      Output:

      JsobjTests::BSONObjTests::AppendNumberLongMin	Expected o1 == o2 ({ a: 0 } == { a: -9223372036854775808 }) @src/mongo/dbtests/jsobjtests.cpp:567
       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              benety.goh Benety Goh
              Reporter:
              scotthernandez Scott Hernandez
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: