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

Coverity analysis defect 99197: Not restoring ostream format

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Trivial - P5
    • Resolution: Fixed
    • None
    • 3.3.9
    • HTTP Console
    • Fully Compatible
    • ALL
    • Platforms 16 (06/24/16)

    Description

      Not restoring the stream format state of an ostream

      Defect 99197 (STATIC_C)
      Checker STREAM_FORMAT_STATE (subcategory none)
      File: /src/mongo/db/stats/snapshots_webplugins.cpp
      Function mongo::<unnamed>::DBTopStatus::display(std::__cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char>> &, double, const mongo::Top::UsageData &)
      /src/mongo/db/stats/snapshots_webplugins.cpp, line: 58
      "setprecision" changes the format state of "ss" for category precision.

                      ss << setprecision(1) << fixed << per;

      /src/mongo/db/stats/snapshots_webplugins.cpp, line: 58
      "fixed" changes the format state of "ss" for category floatfield.

                      ss << setprecision(1) << fixed << per;

      /src/mongo/db/stats/snapshots_webplugins.cpp, line: 61
      Changing format state of stream "ss" for categories floatfield, precision without later restoring it.

              }

      Attachments

        Activity

          People

            andrew.morrow@mongodb.com Andrew Morrow
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: