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

ICNS format: QImageReader::setAllocationLimit() bug

    XMLWordPrintable

Details

    • Linux/Wayland
    • 1b0f4df30 (dev), b3fa83462 (6.7), 63abfd6dd (6.6)

    Description

      Hi,

      Since a recent update to Qt 6.6 I'm having issues loading ICNS files when the allocation limit is disabled. Here is a test code loading an ICNS file with allocation limit disabled and saving it as JPEG:

      #include <QCoreApplication>
      #include <QImageReader>
      #include <QFileInfo>
      
      int main(int argc, char *argv[]) {
      
          QCoreApplication a(argc, argv);
      
          QString filename = "/path/to/sample.icns";
      
          QImageReader reader(filename);
      
          reader.setAllocationLimit(0);
      
          QImage img;
          reader.read(&img);
      
          img.save("/path/to/sample.jpg");
      
          return 0;
      }
      

      I also attaches a sample.icns file I used in my testing. When I run the above code as is with the allocation limit set to 0, then I get this error message and no resulting jpeg file:

      maximum memory limit (0) would be exceeded
      Jasper thread initialization failed
      QICNSHandler::read(): Failed, compressed format "jp2" is not supported by your Qt library or this file is corrupt. OSType: "ic08"
      

      If I change the allocation limit to something greater than 0 (or remove it altogether), then the above error message disappears and the file is successfully saved as jpeg file.

      I tested some other file types and the behavior of QImageReader was as expected, I only observed this issue with ICNS files.

      Attachments

        For Gerrit Dashboard: QTBUG-118797
        # Subject Branch Project Status CR V

        Activity

          People

            vgt Eirik Aavitsland
            luspi Lukas Spies
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes