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

Support large doubles and other double values in FTDC

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.7, 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v5.0, v4.4
    • Security 2020-10-05
    • 56

      FTDC converts doubles to int64. This leads to undefined behavior if the double is -inf, +inf or does not fit in [INT64_MIN, INT64_MAX].

      This was detected by clang's ubsan sanitizer

      -fsanitize=float-cast-overflow: Conversion to, from, or between floating-point types which would overflow the destination. Because the range of representable values for all floating-point types supported by Clang is [-inf, +inf], the only cases detected are conversions from floating point to integer types.
      

      References:
      https://github.com/llvm/llvm-project/blob/42170b3b4e1f7d30b377a3da07c354feae9b852e/compiler-rt/lib/ubsan/ubsan_handlers.cpp#L481-L520
      https://github.com/llvm/llvm-project/blob/646f19bb9dc86ea5baf38969697a15d0f162ddb0/clang/lib/CodeGen/CGExprScalar.cpp#L897-L963

            Assignee:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Reporter:
            mark.benvenuto@mongodb.com Mark Benvenuto
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: