[Digikam-devel] [Bug 112801] digikarm refuses to start: Unsupported JPEG data precision 12
Renchi Raju
renchi.raju at kdemail.net
Sun Sep 18 01:07:12 BST 2005
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=112801
renchi.raju kdemail net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From renchi.raju kdemail net 2005-09-18 02:07 -------
SVN commit 461552 by pahlibar:
override default jpeg error handling so that the
program doesn't bail out on encoutering a rogue jpeg
file
BUGS: 112801
M +37 -8 jpegmetadata.cpp
--- trunk/extragear/graphics/digikam/libs/jpegutils/jpegmetadata.cpp #461551:461552
@ -19,6 +19,7 @
* ============================================================ */
#include <qfile.h>
+#include <kdebug.h>
#include <libkexif/kexifdata.h>
#include "jpegmetadata.h"
@ -27,8 +28,28 @
extern "C" {
#include <stdio.h>
#include <jpeglib.h>
+#include <setjmp.h>
}
+struct readJPEGMetaData_error_mgr : public jpeg_error_mgr
+{
+ jmp_buf setjmp_buffer;
+};
+
+extern "C"
+{
+ static void readJPEGMetaData_error_exit(j_common_ptr cinfo)
+ {
+ readJPEGMetaData_error_mgr* myerr =
+ (readJPEGMetaData_error_mgr*) cinfo->err;
+
+ char buffer[JMSG_LENGTH_MAX];
+ (*cinfo->err->format_message)(cinfo, buffer);
+ kdWarning() << buffer << endl;
+ longjmp(myerr->setjmp_buffer, 1);
+ }
+}
+
namespace Digikam
{
@ -42,18 +63,26 @
comments = QString();
datetime = QDateTime();
- struct jpeg_decompress_struct srcinfo;
- struct jpeg_error_mgr jsrcerr;
+ FILE *input_file = fopen(QFile::encodeName(filePath), "rb");
+ if (!input_file)
+ return;
+
+ struct jpeg_decompress_struct srcinfo;
+ struct readJPEGMetaData_error_mgr jerr;
- srcinfo.err = jpeg_std_error(&jsrcerr);
+ srcinfo.err = jpeg_std_error(&jerr);
+ srcinfo.err->error_exit = readJPEGMetaData_error_exit;
+
+ if (setjmp(jerr.setjmp_buffer))
+ {
+ jpeg_destroy_decompress(&srcinfo);
+ fclose(input_file);
+ return;
+ }
+
jpeg_create_decompress(&srcinfo);
- FILE *input_file;
- input_file = fopen(QFile::encodeName(filePath), "rb");
- if (!input_file)
- return;
-
unsigned short header;
if (fread(&header, 2, 1, input_file) != 1)
More information about the Digikam-devel
mailing list