-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segmentation fault when reading an array of fixed length strings (inc in ncdump) #2159
Comments
I think I see the problem. Netcdf-4 does not support HDF5 style fixed length strings; it only
You are in effect doing the equivalent of allocated a 5 element array each of wholes elements
|
4.9.0 segfaults when trying to read an hdf5 file with fixed length string arrays (test file available at Unidata/netcdf4-python#1172). |
I have a fix that I am testing now. Your identification of
as the source of the problem appears to be correct, although the fix |
re: Unidata#2159 There was error in libhdf5 that only allowed reading a single value HDF5 fixed string. Fix to allow reading an array of such strings. Also make sure it still works for scalars and for attributes. Add a testcase: nc_test4/tst_fixedstring.sh.
I have been writing a file handler in C++ for HDF5 files with v4.8.1 on Linux (Centos7).
Everything has gone well until I tried to read an array of fixed length strings.
I created a test file with a single Group and then a single Dataset of strings of fixed length 20 in a 1 dimensional array of 5 strings. If I then call ncdump on that file I get a segmentation fault (output from ncdump at the end of this post). Stepping through my own code with the same file reveals a segmentation fault when I call nc_free_string on this dataset.
I've stepped into the code and looking at line 1875 of hdf5var.c, it seems to allocate memory for just the first string in the array (fstring_len is 20):
Is there something I've misunderstood, or is this a bug in the library?
Thanks
Ian
StringTest.txt
The text was updated successfully, but these errors were encountered: