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

QImage::fromData() infinite loop on an image that can be loaded with QImage( path)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.7.1
    • 4.7.0
    • Image formats
    • None
    • Windows XP sp3. Visual Studio 2008 SP1
    • 5220c371176951e12d525ac7908861d111c367d0

    Description

      The attached image loads successfully with QImage( const QString& ) .
      But if the image data is first read to memory buffer, and QImage::fromData() is used, the image loading ends up to infinite loop within the bowels of QJpegHandler.
      Also trying to use QBuffer and QImageReader to read from memory fails the same way.

      #include <QtGui/QApplication>
      #include <QPixmap>
      #include <QImage>
      #include <QLabel>
      #include <QFile>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QString pathToImage = "image_1404.jpg";
      
      //   This loads the image successfully
          QImage img( pathToImage);
          QLabel l;
          l.setPixmap( QPixmap::fromImage( img)); 
          l.show();
      
      //  This will infinite-loop in jdmarker.c
          QFile f( pathToImage);
          if( f.open( QIODevice::ReadOnly))
          {
              QByteArray a = f.readAll();
              img = QImage::fromData( a);
          }
      
          QLabel l2;
          l2.setPixmap( QPixmap::fromImage( img));
          l2.show();
      
          return a.exec();
      }
      

      Attachments

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

        Activity

          People

            kkalland Kim Motoyoshi Kalland (Inactive)
            askot Asko Tiihonen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes