Compound members vanish when a variable-length string member is NULL
I maintainer di solito rispondono entro 1 giorno
@mattjala ci sta già lavorando.
Dal 13/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
When a compound has a variable-length string member whose stored value is NULL, that
member does not come back from the HDF5 JNI at all. The member list is one entry short,
so every member after the NULL moves up a place and HDFView reads the wrong member for
each of them. Reading the last position throws IndexOutOfBoundsException, which is what
surfaces in the table as *ERROR*.
The data is already wrong when it crosses the JNI boundary, before HDFView sees it, so
HDFView cannot fix the values. It can detect the condition, which is covered at the end.
Root Cause
java/src-jni/jni/h5util.c in the HDF5 source. translate_rbuf appends each compound
member's converted value to the row only when the conversion produced an object:
jobj = translate_atomic_rbuf(ENVONLY, memb, memb_vlClass,
char_buf + i * typeSize + memb_offset, memb_vlSize);
if (jobj) {
ENVPTR->CallBooleanMethod(ENVONLY, jList, arrAddMethod, (jobject)jobj);
...
}
A NULL variable-length string deliberately converts to a Java null a few lines earlier,
to avoid passing NULL to NewStringUTF, so the member is skipped instead of recorded.
The same guard appears in three places:
- the compound member loop in
translate_rbuf, for a top level compound - the compound member loop in
translate_atomic_rbuf, for a compound nested in another type - the element loop for a sequence of atomic values, so an array of strings also loses its
NULL entries and comes back short
Reproducing
This can be reproduced with a compound of {int id, varstr name, double val} with nothing written to it. The default
fill is zero bytes, so each string pointer reads back as NULL:
nmembers in datatype = 3
row 0 size=2 contents=[0, 0.0]
row 1 size=2 contents=[0, 0.0]
Three members in the datatype, two values in the row, and val has moved into name's
position.
On a real file, bug0951_StitchTest19_4_25_raw1.h5 at
/Groups/StichTest/StitchTest/0x00000000/Applications/CCD-Acquire/MeshFitPara, where
h5dump shows one KeyList element as
("RetardationRatio"), DOUBLE, NULL, 0.2, 0, 1000:
before: list size=5 [RetardationRatio], 1, 0.2, 0.0, 1000
after: list size=6 [RetardationRatio], 1, null, 0.2, 0.0, 1000
Origin
This is not a regression in recent HDFView. The guard dates to HDF5 #2156 and #2232 in late 2022 and is present
unchanged at the hdf5_2.0.0 release tag, which is what HDFView 3.4.1 shipped against,
as well as on current develop. It became visible in the 3.5.0 pre-release because the nested compound
work made these datasets readable at all. In 3.4.1 the same files could not be opened.
The FFM implementation of the Java bindings, which is the default on Java 25 and above,
does not have this problem. It keeps the member's position and returns an empty string.
Only the JNI implementation is affected.
Likely fix in HDF5
Drop the guard at all three sites and store the value whether or not it is null. An
ArrayList accepts null, and DeleteLocalRef on NULL is a no op, so this is a small change.
Next Steps for HDFView
The condition is detectable from the datatype, so HDFView can avoid rendering potentially incorrect values until a fix gets into the JNI itself. Once a JNI patch gets in, this can be removed.
- Lingua principale
- Java
- Stelle
- 157
- Fork
- 28
- Merge medio
- 16h 22m
- PR unite (30g)
- 12
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HDFGroup/hdfview
-
Crash when displaying struct member informationForse già presa @mattjala l’ha presa 2 giorni fa. ApertaComponent - HDFView
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
HDFGroup/hdfview#516 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
User's Guide can't be opened from Help MenuForse già presa @mattjala l’ha presa 22 giorni fa. ApertaComponent - HDFView
HDFGroup/hdfview#512 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Component - Build
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
Fixed-length strings read past the end of their fieldForse di nuovo libera @mattjala l’ha presa 30 giorni fa e non c’è nessuna pull request aperta. ApertaComponent - Object Library
HDFGroup/hdfview#504 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Add global vs. user-specific install option in MSIForse di nuovo libera @mattjala l’ha presa 34 giorni fa e non c’è nessuna pull request aperta. ApertaComponent - Build
HDFGroup/hdfview#495 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di HDFGroup/hdfview
Issue simili
-
bug emitter:client:csharp
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
microsoft/typespec#12572 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
GCC 15.2: -Wcast-qual warning - cast discards const qualifier from pointer target type (H5trace.c)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] RemotingHelper.connect swaps the socket send and receive buffer configurationForse già presa @amalsaidov l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
needs-area-label
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
area/ai area/backend component/zeebe kind/task
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno