diff options
author | aavit <qt-info@nokia.com> | 2010-12-01 10:52:00 (GMT) |
---|---|---|
committer | aavit <qt-info@nokia.com> | 2010-12-01 10:52:00 (GMT) |
commit | fa72ccc5076e80c9a4c51501d8ff7c8161abfdeb (patch) | |
tree | 69d1870c017262797506d378c89708a84b76c8e5 /src/gui/image | |
parent | 0bc9a8abf52c1d4c98aefdb502487bcb8eb131bc (diff) | |
download | Qt-fa72ccc5076e80c9a4c51501d8ff7c8161abfdeb.zip Qt-fa72ccc5076e80c9a4c51501d8ff7c8161abfdeb.tar.gz Qt-fa72ccc5076e80c9a4c51501d8ff7c8161abfdeb.tar.bz2 |
Improvement of de30288: handle PNGs having 1 to 4 bytes truncated.
Task-number: QT-4103
Reviewed-by: trustme
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index a4d669b..1a78bae 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -156,10 +156,11 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr); QIODevice *in = d->q->device(); - if (d->state == QPngHandlerPrivate::ReadingEnd && in->atEnd() && length == 4) { + if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) { // Workaround for certain malformed PNGs that lack the final crc bytes uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 }; qMemCopy(data, endcrc, 4); + in->seek(in->size()); return; } |