diff options
author | Robert Xu <[email protected]> | 2012-07-28 17:22:06 -0400 |
---|---|---|
committer | Robert Xu <[email protected]> | 2012-07-28 17:22:06 -0400 |
commit | 44279fd56aa28d4943b49e516ac791900c561488 (patch) | |
tree | 11289e75f32c5324c5f7469141881720af4f57fe /opensuse/core/tqt3/limit-image-size.diff | |
parent | 48e7f603b222a82ae22d94ecbd6cbba914144f86 (diff) | |
download | tde-packaging-44279fd56aa28d4943b49e516ac791900c561488.tar.gz tde-packaging-44279fd56aa28d4943b49e516ac791900c561488.zip |
initial package (failing) of tqt3 for SuSE12.1
Diffstat (limited to 'opensuse/core/tqt3/limit-image-size.diff')
-rw-r--r-- | opensuse/core/tqt3/limit-image-size.diff | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/opensuse/core/tqt3/limit-image-size.diff b/opensuse/core/tqt3/limit-image-size.diff new file mode 100644 index 000000000..2c5b12bdc --- /dev/null +++ b/opensuse/core/tqt3/limit-image-size.diff @@ -0,0 +1,92 @@ +Index: src/kernel/qasyncimageio.cpp +=================================================================== +--- src/kernel/qasyncimageio.cpp.orig ++++ src/kernel/qasyncimageio.cpp +@@ -904,7 +904,12 @@ int TQGIFFormat::decode(TQImage& img, TQ + sheight = newtop + newheight; + + if (img.isNull()) { +- img.create(swidth, sheight, 32); ++ bool ok = img.create(swidth, sheight, 32); ++ if (!ok) ++ { ++ state = Error; ++ break; ++ } + memset( img.bits(), 0, img.numBytes() ); + if (consumer) consumer->setSize(swidth, sheight); + } +@@ -959,9 +964,15 @@ int TQGIFFormat::decode(TQImage& img, TQ + if (backingstore.width() < w + || backingstore.height() < h) { + // We just use the backing store as a byte array +- backingstore.create( TQMAX(backingstore.width(), w), ++ bool ok = backingstore.create( ++ TQMAX(backingstore.width(), w), + TQMAX(backingstore.height(), h), + 32); ++ if (!ok) ++ { ++ state = Error; ++ break; ++ } + memset( img.bits(), 0, img.numBytes() ); + } + for (int ln=0; ln<h; ln++) { +Index: src/kernel/qimage.cpp +=================================================================== +--- src/kernel/qimage.cpp.orig ++++ src/kernel/qimage.cpp +@@ -68,6 +68,8 @@ + #define QT_NO_IMAGE_16_BIT + #endif + ++int qt_max_image_height = 0; ++int qt_max_image_width = 0; + + /*! + \class TQImage +@@ -1211,6 +1213,28 @@ void TQImage::setAlphaBuffer( bool enabl + data->alpha = enable; + } + ++TQSize TQImage::maxImageSize() ++{ ++ if (!qt_max_image_height || !qt_max_image_width) ++ return TQSize(); ++ return TQSize(qt_max_image_height, qt_max_image_width); ++} ++ ++void TQImage::setMaxImageSize(const TQSize &size) ++{ ++ if (size.isValid()) ++ { ++ qt_max_image_height = size.height(); ++ qt_max_image_width = size.width(); ++ } ++ else ++ { ++ qt_max_image_height = 0; ++ qt_max_image_width = 0; ++ } ++} ++ ++ + + /*! + Sets the image \a width, \a height, \a depth, its number of colors +@@ -1240,6 +1264,14 @@ bool TQImage::create( int width, int hei + reset(); // reset old data + if ( width <= 0 || height <= 0 || depth <= 0 || numColors < 0 ) + return FALSE; // invalid parameter(s) ++ if ( qt_max_image_height && (height > qt_max_image_height * 4)) ++ return FALSE; // Too high ++ if ( qt_max_image_width && (width > qt_max_image_width * 4)) ++ return FALSE; // Too wide ++ if ( qt_max_image_height && qt_max_image_width && ++ (height * width > qt_max_image_height * qt_max_image_width)) ++ return FALSE; // Too large ++ + if ( depth == 1 && bitOrder == IgnoreEndian ) { + #if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::create: Bit order is required for 1 bpp images" ); |