[Digikam-devel] branches/stable/extragear/graphics/digikam/libs/dcraw

Gilles Caulier caulier.gilles at free.fr
Tue Jun 6 09:54:48 BST 2006


SVN commit 548671 by cgilles:

digikam from stable: dcraw::parse bugfix : in rare case, if RAW file cannot be open, FILE handler is wrong and digiKam can crash.
CCMAIL: digikam-devel at kde.org

 M  +15 -6     dcraw_parse.cpp  
 M  +2 -3      dcraw_parse.h  


--- branches/stable/extragear/graphics/digikam/libs/dcraw/dcraw_parse.cpp #548670:548671
@@ -1,9 +1,9 @@
 /* ============================================================
  * Author: Gilles Caulier <caulier dot gilles at free.fr>
  * Date  : 2005-12-20
- * Description :
+ * Description : Raw Photo Parser
  * 
- * Copyright 2005 by Gilles Caulier
+ * Copyright 2005-2006 by Gilles Caulier
  *
  * Original Raw Photo Parser source code come form parse.c
  * Revision: 1.53 - Date: 2005/11/04 06:38:24 
@@ -56,6 +56,7 @@
 DcrawParse::DcrawParse()
 {
     order = 0;
+    ifp   = 0;
 }
     
 DcrawParse::~DcrawParse()
@@ -1142,11 +1143,15 @@
 {
     char head[32], *cp;
     unsigned hlen, fsize, toff, tlen;
+    make[0] = model[0] = model2[0] = is_dng = 0;
+    thumb_head[0] = thumb_offset = thumb_length = thumb_layers = 0;
 
     ifp = fopen (infile,"rb");
+    if (!ifp) {
+      perror (infile);
+      return 1;
+    }
 
-    make[0] = model[0] = model2[0] = is_dng = 0;
-    thumb_head[0] = thumb_offset = thumb_length = thumb_layers = 0;
     order = get2();
     hlen = get4();
     fseek (ifp, 0, SEEK_SET);
@@ -1210,12 +1215,16 @@
 {
   char head[32], *thumb, *rgb, *cp;
   unsigned hlen, fsize, toff, tlen, lsize, i;
+  make[0] = model[0] = model2[0] = is_dng = 0;
+  thumb_head[0] = thumb_offset = thumb_length = thumb_layers = 0;
   FILE *tfp;
 
   ifp = fopen (infile,"rb");
+  if (!ifp) {
+    perror (infile);
+    return 1;
+  }
 
-  make[0] = model[0] = model2[0] = is_dng = 0;
-  thumb_head[0] = thumb_offset = thumb_length = thumb_layers = 0;
   order = get2();
   hlen = get4();
   fseek (ifp, 0, SEEK_SET);
--- branches/stable/extragear/graphics/digikam/libs/dcraw/dcraw_parse.h #548670:548671
@@ -1,9 +1,9 @@
 /* ============================================================
  * Author: Gilles Caulier <caulier dot gilles at free.fr>
  * Date  : 2005-12-20
- * Description :
+ * Description : Raw Photo Parser
  * 
- * Copyright 2005 by Gilles Caulier
+ * Copyright 2005-2006 by Gilles Caulier
  *
  * This program is free software; you can redistribute it
  * and/or modify it under the terms of the GNU General
@@ -52,7 +52,6 @@
 
     FILE  *ifp;
     short  order;
-    char  *fname;
     char   make[128], model[128], model2[128], thumb_head[128];
     int    width, height, offset, length, bps, is_dng;
     int    thumb_offset, thumb_length, thumb_layers;



More information about the Digikam-devel mailing list