question about H5DSget_label

I'm working on adding h5py python bindings for the H5DS API. The work
is nearly complete, nearly all of the unit tests I have assembled so
far are passing. However, if I have a 3-dimensional dataset, and I do
the equivalent of:

H5DSset_label(did, 0, 'x')
H5DSset_label(did, 2, 'z')

When I try to determine the length of the label, so I can allocate a
buffer of the appropriate length, I have no problem for the x or z
dimensions:

size = H5DSget_label(did, 0, NULL, 0)

but when I try to determine the size for dimension 1, which has no
label, I get a segfault:

size = H5DSget_label(did, 1, NULL, 0)

If I explicitly set dimension 1's label with H5DSset_label(did, 1,
''), then the above call to H5DSget_label works as expected.

I'm sorry, I have zero experience writing C programs, so I haven't
been able to produce an example in C that reproduces the problem. I
suspect the problem may be related to the line in H5DS.c:

nbytes = strlen(buf[idx]);

but I could be wrong.

Darren

Hi Darren,

I opened a ticket for this issue. We will take a look.

Thank you for reporting!

Elena

ยทยทยท

On Jul 29, 2011, at 10:42 AM, Darren Dale wrote:

I'm working on adding h5py python bindings for the H5DS API. The work
is nearly complete, nearly all of the unit tests I have assembled so
far are passing. However, if I have a 3-dimensional dataset, and I do
the equivalent of:

H5DSset_label(did, 0, 'x')
H5DSset_label(did, 2, 'z')

When I try to determine the length of the label, so I can allocate a
buffer of the appropriate length, I have no problem for the x or z
dimensions:

size = H5DSget_label(did, 0, NULL, 0)

but when I try to determine the size for dimension 1, which has no
label, I get a segfault:

size = H5DSget_label(did, 1, NULL, 0)

If I explicitly set dimension 1's label with H5DSset_label(did, 1,
''), then the above call to H5DSget_label works as expected.

I'm sorry, I have zero experience writing C programs, so I haven't
been able to produce an example in C that reproduces the problem. I
suspect the problem may be related to the line in H5DS.c:

nbytes = strlen(buf[idx]);

but I could be wrong.

Darren