Skip to content
  • Martin Tobias Holmedahl Sandsmark's avatar
    Fix segfault/call on invalid pointer · 6cc5a511
    Martin Tobias Holmedahl Sandsmark authored
    We didn't set the AbstractImageView in AbstractImageViewPrivate early
    enough, and createAlphaBackgroundTexture() tried to call stuff on q.
    
    Quote from asan:
    
    ==161679==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fa8cdcc193a bp 0x7ffe601e4a00 sp 0x7ffe601e48f0 T0)
    ==161679==The signal is caused by a READ memory access.
    ==161679==Hint: address points to the zero page.
        #0 0x7fa8cdcc1939 in Gwenview::AbstractImageViewPrivate::createAlphaBackgroundTexture() (gwenview/build/bin/libgwenviewlib.so.5+0x108a939)
        #1 0x7fa8cdcc28b8 in Gwenview::AbstractImageViewPrivate::AbstractImageViewPrivate() (gwenview/build/bin/libgwenviewlib.so.5+0x108b8b8)
        #2 0x7fa8cdca46a2 in Gwenview::AbstractImageView::AbstractImageView(QGraphicsItem*) ../lib/documentview/abstractimageview.cpp:145
        #3 0x7fa8cdd500a5 in Gwenview::RasterImageView::RasterImageView(QGraphicsItem*) ../lib/documentview/rasterimageview.cpp:194
    
    Reviewed By: ngraham
    
    Differential Revision: https://phabricator.kde.org/D28345
    6cc5a511