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

Coverity analysis defect 104963: Not restoring ostream format

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.1.3
    • Component/s: Internal Code
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Platforms 2018-08-27, Platforms 2018-09-10

      Description

      Not restoring the stream format state of an ostream

      Defect 104963 (STATIC_C)
      Checker STREAM_FORMAT_STATE (subcategory none)
      File: /src/mongo/bson/bsonelement.cpp
      Function mongo::BSONElement::jsonStringStream(mongo::JsonStringFormat, bool, int, std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>> &) const
      /src/mongo/bson/bsonelement.cpp, line: 90
      "precision" changes the format state of "s" for category precision.

                          s.precision(16);

      /src/mongo/bson/bsonelement.cpp, line: 314
      Changing format state of stream "s" for category precision without later restoring it.

          }

      File: /src/mongo/bson/bsonelement.cpp
      Function mongo::BSONElement::jsonStringStream(mongo::JsonStringFormat, bool, int, std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>> &) const
      /src/mongo/bson/bsonelement.cpp, line: 209
      "hex" changes the format state of "s" for category basefield.

                      s << "\", \"$type\" : \"" << hex;

      /src/mongo/bson/bsonelement.cpp, line: 211
      "fill" changes the format state of "s" for category fill.

                      s.fill('0');

      /src/mongo/bson/bsonelement.cpp, line: 212
      "dec" changes the format state of "s" for category basefield.

                      s << type << dec;

      /src/mongo/bson/bsonelement.cpp, line: 314
      Changing format state of stream "s" for category fill without later restoring it.

          }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: