Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-24997

QTextStream is in a corrupted state after reading to end and seeking to 0 - and calling pos() can then corrupt it more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 4.7.4, 4.8.1
    • Core: I/O
    • None
    • Debian unstable

    Description

      Consider the attached program which is meant to analyze some very basic statistics on the GPL-3 file. However, the pos() call returns -1 instead of the real offset.

      In the actual code which this test case is extracted from, and using the file which triggered the condition, I didn't get -1 but a random position in the file which was much later than the position it should have been. And the pos() reset the file position so that the subsequent readLine() calls started with a partial line.

      I also tried inserting resetStatus(), reset(), or even reopening the file and then reassigning the IO device, with no changes in behavior.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            dschepler Daniel Schepler
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes