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

Crash in QImage::scaled

    XMLWordPrintable

Details

    • 15051e205 (dev), 993db3ee9 (6.7), 4c674c8bd (6.6), 1fb4dd5d4 (tqtc/lts-6.5)

    Description

      The following program crashes. See attachment for the input image

      #include <QImage>
      
      int main(int argc, char *argv[])
      {
          QImage img("img.png");
          img.setDevicePixelRatio(2);
          img.scaled(QSize(320, 320), Qt::KeepAspectRatio, Qt::SmoothTransformation);
      }

      See also https://bugs.kde.org/show_bug.cgi?id=477342

      Backtrace:

      Thread 4 (Thread 0x7fffee9976c0 (LWP 162088) "Thread (pooled)"):
      
      #0  fetchIndexedToARGB32PM<(QPixelLayout::BPP)3>(uint*, uchar const*, int, int, QList<unsigned int> const*, QDitherInfo*) (buffer=buffer@entry=0x7fffee9899b0, src=0x7ff
      fef9eb010 '\361' <repeats 199 times>, <incomplete sequence \361>..., index=index@entry=0, count=count@entry=512, clut=clut@entry=0x0) at /home/nico/workspace/qt6/qtbase
      /src/gui/painting/qpixellayout.cpp:758
      
      #1  0x00007ffff7cf5759 in fetchTransformedBilinear_simple_scale_helper<(TextureBlendType)4>(uint*, uint*, QTextureData const&, int&, int, int, int&) (b=b@entry=0x7fffee
      994b70, end=end@entry=0x7fffee995070, image=<optimized out>, fx=@0x7fffee98e2c0: 19659, fdx=104857, fy=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/paint
      ing/qdrawhelper.cpp:2075
      
      #2  0x00007ffff7d16ab8 in fetchTransformedBilinear<(TextureBlendType)4, (QPixelLayout::BPP)0>(uint*, Operator const*, QSpanData const*, int, int, int) (buffer=0x7fffee9
      94b70, data=<optimized out>, y=<optimized out>, x=<optimized out>, length=320) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:2340
      
      #3  0x00007ffff7d22507 in BlendSrcGeneric::fetch(int, int, int, bool) (fetchDest=false, len=<optimized out>, y=<optimized out>, x=0, this=0x7fffee992b50) at /home/nico/
      workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4041
      
      #4  handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda(int, int)#1}::operator()(int, int) const (__closure=0x7fffffffbca0
      , cStart=<optimized out>, cEnd=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:3993
      
      #5  0x00007ffff7d226f1 in handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda()#1}::operator()() const (__closure=0x4780f8
      ) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4015
      
      #6  QRunnable::QGenericRunnable::Helper<handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda()#1}>::impl(QRunnable::QGeneri
      cRunnable::HelperBase::Op, QRunnable::QGenericRunnable::HelperBase*, void*) (op=<optimized out>, that=0x4780f0, arg=<optimized out>) at /home/nico/workspace/qt6/qtbase/
      include/QtCore/../../src/corelib/thread/qrunnable.h:73
      
      #7  0x00007ffff70f5314 in QThreadPoolThread::run() (this=0x478120) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthreadpool.cpp:66
      
      #8  0x00007ffff70f0797 in operator() (__closure=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:324
      
      #9  (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/q
      thread_unix.cpp:260
      
      #10 QThreadPrivate::start(void*) (arg=0x478120) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:283
      
      #11 0x00007ffff68ac897 in start_thread (arg=<optimized out>) at pthread_create.c:444
      
      #12 0x00007ffff69336fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      
      
      
      Thread 3 (Thread 0x7fffef1986c0 (LWP 162087) "Thread (pooled)"):
      
      #0  0x00007ffff7982f4e in QArrayDataPointer<unsigned int>::data() const (this=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qarraydatapointer.h:
      114
      
      #1  QList<unsigned int>::data() const (this=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qlist.h:415
      
      #2  QList<unsigned int>::at(long long) const (i=<optimized out>, this=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qlist.h:432
      
      #3  fetchIndexedToARGB32PM<(QPixelLayout::BPP)3>(uint*, uchar const*, int, int, QList<unsigned int> const*, QDitherInfo*) (buffer=buffer@entry=0x7fffef18a9b0, src=0x7ff
      fef9df010 '\361' <repeats 199 times>, <incomplete sequence \361>..., index=index@entry=0, count=count@entry=512, clut=clut@entry=0x0) at /home/nico/workspace/qt6/qtbase
      /src/gui/painting/qpixellayout.cpp:758
      
      #4  0x00007ffff7cf5759 in fetchTransformedBilinear_simple_scale_helper<(TextureBlendType)4>(uint*, uint*, QTextureData const&, int&, int, int, int&) (b=b@entry=0x7fffef
      195b70, end=end@entry=0x7fffef196070, image=<optimized out>, fx=@0x7fffef18f2c0: 19659, fdx=104857, fy=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/paint
      ing/qdrawhelper.cpp:2075
      
      #5  0x00007ffff7d16ab8 in fetchTransformedBilinear<(TextureBlendType)4, (QPixelLayout::BPP)0>(uint*, Operator const*, QSpanData const*, int, int, int) (buffer=0x7fffef1
      95b70, data=<optimized out>, y=<optimized out>, x=<optimized out>, length=320) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:2340
      
      #6  0x00007ffff7d22507 in BlendSrcGeneric::fetch(int, int, int, bool) (fetchDest=false, len=<optimized out>, y=<optimized out>, x=0, this=0x7fffef193b50) at /home/nico/
      workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4041
      
      #7  handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda(int, int)#1}::operator()(int, int) const (__closure=0x7fffffffbca0
      , cStart=<optimized out>, cEnd=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:3993
      
      #8  0x00007ffff7d226f1 in handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda()#1}::operator()() const (__closure=0x432908
      ) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4015
      
      --Type <RET> for more, q to quit, c to continue without paging--c
      
      #9  QRunnable::QGenericRunnable::Helper<handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda()#1}>::impl(QRunnable::QGeneri
      cRunnable::HelperBase::Op, QRunnable::QGenericRunnable::HelperBase*, void*) (op=<optimized out>, that=0x432900, arg=<optimized out>) at /home/nico/workspace/qt6/qtbase/
      include/QtCore/../../src/corelib/thread/qrunnable.h:73
      
      #10 0x00007ffff70f5314 in QThreadPoolThread::run() (this=0x432930) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthreadpool.cpp:66
      
      #11 0x00007ffff70f0797 in operator() (__closure=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:324
      
      #12 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/q
      thread_unix.cpp:260
      
      #13 QThreadPrivate::start(void*) (arg=0x432930) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:283
      
      #14 0x00007ffff68ac897 in start_thread (arg=<optimized out>) at pthread_create.c:444
      
      #15 0x00007ffff69336fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      
      
      
      Thread 2 (Thread 0x7fffef9996c0 (LWP 162086) "Thread (pooled)"):
      
      #0  0x00007ffff7982f4e in QArrayDataPointer<unsigned int>::data() const (this=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qarraydatapointer.h:
      114
      
      #1  QList<unsigned int>::data() const (this=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qlist.h:415
      
      #2  QList<unsigned int>::at(long long) const (i=<optimized out>, this=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qlist.h:432
      
      #3  fetchIndexedToARGB32PM<(QPixelLayout::BPP)3>(uint*, uchar const*, int, int, QList<unsigned int> const*, QDitherInfo*) (buffer=buffer@entry=0x7fffef98b9b0, src=0x7ff
      fef9d3010 'd' <repeats 200 times>..., index=index@entry=0, count=count@entry=512, clut=clut@entry=0x0) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qpixellayout.
      cpp:758
      
      #4  0x00007ffff7cf5759 in fetchTransformedBilinear_simple_scale_helper<(TextureBlendType)4>(uint*, uint*, QTextureData const&, int&, int, int, int&) (b=b@entry=0x7fffef
      996b70, end=end@entry=0x7fffef997070, image=<optimized out>, fx=@0x7fffef9902c0: 19659, fdx=104857, fy=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/paint
      ing/qdrawhelper.cpp:2075
      
      #5  0x00007ffff7d16ab8 in fetchTransformedBilinear<(TextureBlendType)4, (QPixelLayout::BPP)0>(uint*, Operator const*, QSpanData const*, int, int, int) (buffer=0x7fffef9
      96b70, data=<optimized out>, y=<optimized out>, x=<optimized out>, length=320) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:2340
      
      #6  0x00007ffff7d22507 in BlendSrcGeneric::fetch(int, int, int, bool) (fetchDest=false, len=<optimized out>, y=<optimized out>, x=0, this=0x7fffef994b50) at /home/nico/
      workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4041
      
      #7  handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda(int, int)#1}::operator()(int, int) const (__closure=0x7fffffffbca0
      , cStart=<optimized out>, cEnd=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:3993
      
      #8  0x00007ffff7d226f1 in handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda()#1}::operator()() const (__closure=0x433138
      ) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4015
      
      #9  QRunnable::QGenericRunnable::Helper<handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&)::{lambda()#1}>::impl(QRunnable::QGeneri
      cRunnable::HelperBase::Op, QRunnable::QGenericRunnable::HelperBase*, void*) (op=<optimized out>, that=0x433130, arg=<optimized out>) at /home/nico/workspace/qt6/qtbase/
      include/QtCore/../../src/corelib/thread/qrunnable.h:73
      
      #10 0x00007ffff70f5314 in QThreadPoolThread::run() (this=0x4627d0) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthreadpool.cpp:66
      
      #11 0x00007ffff70f0797 in operator() (__closure=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:324
      
      #12 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/q
      thread_unix.cpp:260
      
      #13 QThreadPrivate::start(void*) (arg=0x4627d0) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qthread_unix.cpp:283
      
      #14 0x00007ffff68ac897 in start_thread (arg=<optimized out>) at pthread_create.c:444
      
      #15 0x00007ffff69336fc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      
      
      
      Thread 1 (Thread 0x7ffff5e23e00 (LWP 162083) "imgtest"):
      
      #0  syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
      
      #1  0x00007ffff70f226a in QtLinuxFutex::_q_futex(int*, int, int, unsigned long long, int*, int) (val3=0, addr2=0x0, val2=0, val=<optimized out>, op=0, addr=<optimized o
      ut>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qfutex_p.h:64
      
      #2  QtLinuxFutex::futexWait<QBasicAtomicInteger<unsigned int> >(QBasicAtomicInteger<unsigned int>&, QBasicAtomicInteger<unsigned int>::Type) (expectedValue=<optimized o
      ut>, futex=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qfutex_p.h:83
      
      #3  futexSemaphoreTryAcquire_loop<false>(QBasicAtomicInteger<unsigned long long>&, unsigned long long, unsigned long long, QDeadlineTimer) (timer=..., nn=17179869187, c
      urValue=<optimized out>, u=...) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qsemaphore.cpp:174
      
      #4  futexSemaphoreTryAcquire<QDeadlineTimer::ForeverConstant>(QBasicAtomicInteger<unsigned long long>&, int, QDeadlineTimer::ForeverConstant) (timeout=QDeadlineTimer::F
      oreverConstant::Forever, n=n@entry=3, u=...) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qsemaphore.cpp:241
      
      #5  QSemaphore::acquire(int) (this=this@entry=0x7fffffffbc98, n=n@entry=3) at /home/nico/workspace/qt6/qtbase/src/corelib/thread/qsemaphore.cpp:312
      
      #6  0x00007ffff7d22897 in handleSpans<BlendSrcGeneric>(int, QT_FT_Span_ const*, QSpanData const*, Operator const&) (count=count@entry=180, spans=<optimized out>, data=<
      optimized out>, op=...) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qdrawhelper.cpp:4015
      
      #7  0x00007ffff7d20240 in blend_src_generic(int, QT_FT_Span const*, void*) (count=180, spans=<optimized out>, userData=<optimized out>) at /home/nico/workspace/qt6/qtba
      se/src/gui/painting/qdrawhelper.cpp:4138
      
      #8  0x00007ffff799ab04 in QSpanBuffer::flushSpans() (this=0x7fffffffbfb0) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qrasterizer.cpp:83
      
      #9  QSpanBuffer::~QSpanBuffer() (this=0x7fffffffbfb0, __in_chrg=<optimized out>) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qrasterizer.cpp:57
      
      #10 QRasterizer::rasterizeLine(QPointF const&, QPointF const&, double, bool) (this=<optimized out>, a=..., b=..., width=<optimized out>, width@entry=0.5625, squareCap=s
      quareCap@entry=false) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qrasterizer.cpp:1164
      
      #11 0x00007ffff78ed935 in QRasterPaintEngine::drawImage(QRectF const&, QImage const&, QRectF const&, QFlags<Qt::ImageConversionFlag>) (this=this@entry=0x42d1a0, r=..., 
      img=..., sr=...) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qscopedpointer.h:90
      
      #12 0x00007ffff78eeb6c in QRasterPaintEngine::drawImage(QRectF const&, QImage const&, QRectF const&, QFlags<Qt::ImageConversionFlag>) (sr=..., img=..., r=..., this=0x42
      d1a0) at /home/nico/workspace/qt6/qtbase/src/corelib/tools/qrect.h:648
      
      #13 QRasterPaintEngine::drawImage(QPointF const&, QImage const&) (this=0x42d1a0, p=..., img=...) at /home/nico/workspace/qt6/qtbase/src/gui/painting/qpaintengine_raster
      .cpp:2107
      
      #14 0x00007ffff776156b in QPainter::drawImage(QPoint const&, QImage const&) (image=..., p=<optimized out>, this=0x7fffffffd2c0) at /home/nico/workspace/qt6/qtbase/src/g
      ui/painting/qpainter.h:801
      
      #15 QImage::transformed(QTransform const&, Qt::TransformationMode) const (this=this@entry=0x7fffffffd4d0, matrix=..., mode=mode@entry=Qt::SmoothTransformation) at /home
      /nico/workspace/qt6/qtbase/src/gui/image/qimage.cpp:4935
      
      #16 0x00007ffff7762085 in QImage::scaled(QSize const&, Qt::AspectRatioMode, Qt::TransformationMode) const (this=0x7fffffffd4d0, s=<optimized out>, aspectMode=<optimized
       out>, mode=Qt::SmoothTransformation) at /home/nico/workspace/qt6/qtbase/src/gui/image/qimage.cpp:3014
      
      #17 0x000000000040123d in main(int, char**) (argc=1, argv=0x7fffffffd668) at /home/nico/imgtest/main.cpp:7 

      Attachments

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

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            nicolasfella Nicolas Fella
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change