Segmentation violation with H5Fget_intent when passing in a dataset id (in HDF5 1.14.4.3)
HDF5 version - 1.14.4.3 OS : Debian 11 Compiler : gcc
I have a simple reproduction script where I accidently passed in the dataset Id to H5Fget_intent instead of file ID. In HDF5 1.10.11, H5Fget_intent errored out with the message:
“HDF5-DIAG: Error detected in HDF5 (1.10.11) thread 0: #000: H5F.c line 649 in H5Fget_intent(): not a file major: Invalid arguments to routine minor: Inappropriate type”
But, in HDF5 1.14.4.3, the program crashed (segmentation violation) on H5Fget_intent. While I would have expected the error, the segV seems like buggy behavior. Please find my reproduction code below. Also, I could reproduce it with any h5 file.
#include "hdf5.h"
#include <stdio.h>
#include <stdlib.h>
#define FILE1 "example.h5"
#define DATASET1 "/g1/g1.1/dset1.1.1"
int main() {
hid_t file, dset; /* Handles */
herr_t status;
unsigned* intent;
/*
* Create a new file using the default properties.
*/
file = H5Fopen(FILE1, H5F_ACC_RDONLY, H5P_DEFAULT);
dset = H5Dopen(file, DATASET1, H5P_DEFAULT);
printf("Before H5Fget_intent \n");
status = H5Fget_intent(dset, intent);
printf("After H5Fget_intent \n");
H5Dclose(dset);
H5Fclose(file);
return 0;
}
Hi @abhibaruah, The buggy behavior was confirmed and an issue was created for the fix: #4662. Thanks!
@abhibaruah Hi Abhi, I just want to let you know that this issue (aka #4662) is fixed in develop.
@abhibaruah Can this issue be closed?
Thanks Binh-Minh. If this has been fixed then yes it can be closed. Will this fix be in the next 1.14 release? Or is the 1.14 branch unmaintained?
This will be fixed in 1.14.5