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

QImageReader::canRead(), incorrectly returning true for any string starting with "BMS"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2: Important P2: Important
    • None
    • 5.9.1
    • Image formats
    • None
    • The problem occurs on at least Windows (unsure of version) and OSX 10.11.6, using Qt 5.9.1.
    • macOS

      QImageReader::canRead(), is supposed to be a reasonably fast method of determining if a buffer contains image data.

      It seems to be setting the bar a little low though for how in depth it's checking, as it's incorrectly returning `true` for any buffer sequence starting with "BMS".

      We have an open bug reported by one of our users, where their valid (non-image) data starts with that string.  QImageReader::canRead() is incorrectly reporting that as an image file, without looking any further:

      https://github.com/sqlitebrowser/sqlitebrowser/issues/1138

      This causes problems, as our application relies on that return code to determine which data viewer to use.  When canRead() gets it wrong above, that causes things to go down a wrong path.

      It should probably do a bit more checking (eg can a resolution be read?) before returning a positive value.

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

            vgt Eirik Aavitsland
            justinclift justinclift
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes