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

QImageReader QImageReaderPrivate::getText() incorrectly parses Description string

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.8.4
    • Image formats
    • None
    • Linux (Ubuntu 11.10) x86_64

    Description

      The QImageReader QImageReaderPrivate::getText() method does not correctly parse the QImageIOHandler::Description string.

      According to the documentation for the QImageIOHandler::Description ImageOption the format of all key,value pairs is:

      key:value\n\n

      Note that the ':' is the required delimiter of the key and value; no embedded spaces are required; and every pair, including the last, is terminated by two newline characters.

      The QImageReaderPrivate::getText() method produces a QMap of name,value QString pairs by parsing the return value of the Description option: The Description string is split into QString segments on the two newline characters (note that this results in a final empty segment). For each segment, if the index of the ':' delimiter is non-negative and the index of any space character (' ') is less than the delimiter index (note that when no space character is present this index will be -1) the resulting key,value pair in the QMap is "Description" and the entire segment QString::simplified; otherwise the key,value pair is the part of the segment before the delimiter and the part after the segment QString::simplified.

      The conditional determining the key,value pair is incorrect! For example, the typical segment "key:value" will result in a key of "Description" key and a value of "key:value". This can be expected to occur for most, if not all, segments in the formatted Description string, and so only the last "Description" segment will remain in the QMap; all other key:value pairs will be lost. Even if the the value contains a space character it will be incorrectly selected as "alue" instead of "value".

      Attachments

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

        Activity

          People

            rodal Samuel Rødal
            castalia Bradford Castalia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes