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

Undefined behavior when types of NumberLong's fields are changed by user

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.1.9
    • Affects Version/s: 3.1.7
    • Component/s: JavaScript
    • Labels:
    • Fully Compatible
    • ALL
    • Platform 9 (09/18/15), Platform A (10/09/15)
    • 0

      Clang reports undefined behaviour when the following commands were entered into the shell:

      > x = NumberLong(5)
      NumberLong(5)
      > Object.keys(x)
      [ "floatApprox" ]
      > x.floatApprox
      5
      > x.floatApprox = 'g'
      g
      > x.valueOf()
      (/home/sajack/mongo/mongo+0x18652a1): runtime error: value nan is outside the range of representable values of type 'long long'
      SUMMARY: AddressSanitizer: undefined-behavior (/home/sajack/mongo/mongo+0x18652a1): runtime error: value -9.22337e+18 is outside the range of representable values of type 'int'
      SUMMARY: AddressSanitizer: undefined-behavior
      -9223372036854776000
      

            Assignee:
            mira.carey@mongodb.com Mira Carey
            Reporter:
            spencer.jackson@mongodb.com Spencer Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: