Dear HDF community,

The patch in the attached file fixes a memory corruption (double free)
issue in the h5dump utility.

That bug can be reproduced by supplying one existing file and one non
existing file at the command line as you can see below:

$h5dump test/test_filters_be.h5 test/non_existing.h5
HDF5 "test/test_filters_be.h5" {
GROUP "/" {
   DATASET "dset" {
      DATATYPE  H5T_STD_I32BE
      DATASPACE  SIMPLE { ( 2 ) / ( 2 ) }
      DATA {
      (0): 1, 1
      }
   }
}
}
h5dump error: unable to open file "test/non_existing.h5"
*** Error in `h5dump': double free or corruption (out):
0x00000000006e67b0 ***
Aborted


Best regards,
Reinhard Resch
--- origin/hdf5-1.8.15-patch1/tools/h5dump/h5dump.c	2015-05-28 18:01:48.000000000 +0200
+++ hdf5-1.8.15-patch1/tools/h5dump/h5dump.c	2015-12-31 14:17:11.000000000 +0100
@@ -1581,10 +1581,15 @@
             if (H5Fclose(fid) < 0)
                 h5tools_setstatus(EXIT_FAILURE);
 
-        if(prefix)
+        if(prefix) {
             HDfree(prefix);
-        if(fname)
+            prefix = NULL;
+        }
+        
+        if(fname) {
             HDfree(fname);
+            fname = NULL;
+        }
     } /* end while */
 
     if(hand) 
@@ -1604,6 +1609,7 @@
     
     if(prefix)
         HDfree(prefix);
+    
     if(fname)
         HDfree(fname);
 
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to