Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-204

std::filebuf::overflow(EOF) writes garbage in unbuffered mode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 4.1.2, 4.1.3
    • 4.2.0
    • 27. Input/Output
    • None
    • All.

    Description

      The program below dumps core:

      $ cat t.cpp && nice gmake t && ./t
      #include <cassert>
      #include <fstream>

      struct MyBuf: std::filebuf {
      int_type oflow ()

      { return overflow (traits_type::eof ()); }

      };

      int main ()
      {
      MyBuf f;

      assert (0 != f.open ("test.file", std::ios::out | std::ios::trunc));
      assert (0 != f.pubsetbuf (0, 0));

      assert (MyBuf::traits_type::eof () != f.oflow ());

      assert (0 == f.pubseekoff (0, std::ios::end, std::ios::out));
      }
      aCC -c -I/amd/devco/sebor/dev/stdlib/include/ansi -I/usr/include -D_RWSTDDEBUG -mt -D_RWSTD_USE_CONFIG -I/amd/devco/sebor/dev/stdlib/include -I/build/sebor/aCC-3.63-15S/include -I/amd/devco/sebor/dev/stdlib/../rwtest -I/amd/devco/sebor/dev/stdlib/../rwtest/include -I/amd/devco/sebor/dev/stdlib/tests/include -Aa +nostl -g +d +DD64 +w +W392 +W655 +W684 +W818 +W819 +W849 t.cpp
      aCC t.o -o t -L/build/sebor/aCC-3.63-15S/rwtest -lrwtest15S -Aa +nostl -Wl,+s -Wl,+vnocompatwarnings -L/build/sebor/aCC-3.63-15S/lib -mt +DD64 -L/build/sebor/aCC-3.63-15S/lib -lstd15S -lm
      Assertion failed: 0 == f.pubseekoff (0, std::ios::end, std::ios::out), file t.cpp, line 19
      ABORT instruction (core dumped)

      Attachments

        Issue Links

          Activity

            People

              sebor Martin Sebor
              sebor Martin Sebor
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: