Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.4.1
-
None
Description
When I am reading image files, for some JPEG files I get the this warning:
QBuffer::seek: Invalid pos: -720434500
The position value is a per image constant. Even debug/release builds produce the same number for a given image file. So looks like a calculation problem and not uninitialized data.
#include <QFile> #include <QImage> #include <QDebug> int main(int argc, char *argv[]) { // Uncomment this to get a stacktrace in debugger from warning // qputenv("QT_FATAL_WARNINGS", "1"); QFile file("86e231db24c2fd370992d91a9e889636.jpg"); if (!file.open(QIODevice::ReadOnly)) { qFatal("Could not load sample image. Please copy image file manually from source dir to build dir."); return 1; } QByteArray blob = file.readAll(); QImage image; image.fromData(blob); return 0; }
Stacktrace:
QMessageLogger::warning(const char *, ...) const 0x7f2a51ae5db6 QBuffer::seek(long long) 0x7f2a51c3b13b QDataStream::skipRawData(int) 0x7f2a51c3c81a ?? 0x7f2a4aa84485 ?? 0x7f2a4aa84769 QImageReader::read(QImage *) 0x7f2a522dd85c QImageReader::read() 0x7f2a522de057 QImage::fromData(unsigned const char *, int, const char *) 0x7f2a522c2f1b QImage::fromData qimage.h 284 0x4011a4 main main.cpp 20 0x400e5e
The filename of the attached example file equals its md5 sum. The full example is available on GitHub: https://github.com/webmaster128/qbuffertest