Use H5allocate_memory/H5free_memory for buffers exchanged with HDF5 in all filters
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 50/100
Línea de trabajo
Start with the ZSTD fix in #290 as the pattern, then open the per-filter sources listed in the checklist (for example BLOSC/src/H5Zblosc.c and BZIP2/src/H5Zbzip2.c). Swap each malloc/realloc/free on a buffer crossing the callback boundary for H5allocate_memory/H5resize_memory/H5free_memory, and leave filter-private scratch buffers alone. The SZ and MAFISC sites need the most judgment because their library-returned buffers must be copied first. Done means every checklist item is converted and each filter has a passing round-trip test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Background
#289 showed that the ZSTD filter crashed on Windows because it freed the buffer HDF5 passed in (*buf) with the plugin's CRT free(), and returned a buffer from the plugin's CRT malloc() for HDF5 to free. The plugin DLL and hdf5.dll can link different CRTs, so the allocator and deallocator must match. #290 fixes ZSTD.
The rule: any buffer that crosses the filter callback boundary must use H5allocate_memory() / H5resize_memory() / H5free_memory(). That means the old *buf being released and the new buffer assigned to *buf, including the error-path free of that new buffer. Buffers private to the filter (scratch space, library-internal state) can stay on malloc/free.
Line numbers are against master at bafec5a3.
Filters to change
- BLOSC
BLOSC/src/H5Zblosc.c:mallocat 297, 332;free(outbuf)at 317, 354;free(*buf)at 347 - BLOSC2
BLOSC2/src/H5Zblosc2.c:mallocat 619, 656;free(*buf)at 684;free(outbuf)at 692. Thefree(chunk)at 675 is internal; checkneeds_freeand leave it unless the chunk comes from HDF5. - BSHUF
BSHUF/src/H5Zbshuf.c:mallocat 300;free(out_buf)at 358;free(*buf)at 362. Themalloc/freeinbitshuffle.candbitshuffle_core.care scratch buffers and stay. - BZIP2
BZIP2/src/H5Zbzip2.c:mallocat 155, 232;reallocat 188 (useH5resize_memory);free(*buf)at 249;free(outbuf)at 256. The comment at 161 refers to bzip2's internal allocator and stays. - JPEG
JPEG/src/H5Zjpeg.c:mallocat 189, 333;free(*buf)at 348;free(out_buf)at 357. Check whetheroutData(346, 355) is library-owned. - LZ4
LZ4/src/H5Zlz4.c:mallocat 155, 243;free(*buf)at 187, 285;free(outBuf)at 293, 298 - LZF
LZF/src/H5Zlzf.c:mallocat 253, 282;free(outbuf)at 276, 318;free(*buf)at 311 - ZFP
ZFP/H5Z-ZFP/src/H5Zzfp.c:mallocat 607, 674;free(*buf)at 649, 697;free(newbuf)at 708. Thectrls_pallocation inH5Zzfp_props.cis not passed to HDF5 and stays. - SZ (community)
community/SZ/src/H5Zszf.c:free(*buf)at 583-786, about 25 sites.SZ_compress*andSZ_decompressreturn buffers allocated inside the SZ library withmalloc. Those results need to be copied into anH5allocate_memory()buffer before they are assigned to*buf, then freed with the SZ library's allocator. This one is more than a mechanical swap. - MAFISC (community)
community/MAFISC/src/mafisc.c:free(*buffer)at 762 withbuffer2(mallocat 730) assigned to*buffer. Check the compress path around 829-912 (buffer1,buffer2,curBuffer,bestBuffer) for whichever buffer is returned to HDF5. - ZSTD
ZSTD/src/H5Zzstd.c: fixed in #290
No change needed
These filters modify *buf in place and never replace it.
- BITGROOM:
mss_valatH5Zbitgroom.c:393is internal. - GRANULAR_BITROUND:
mss_valatH5Zgranularbr.c:388is internal. - BITROUND
Verification
Each filter should get a round-trip test, plus a check under an allocator-aware tool (ASan or the MSVC debug heap) where possible. Windows with mismatched CRTs is the case that fails.
- Lenguaje dominante
- CMake
- Estrellas
- 21
- Forks
- 27
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de HDFGroup/hdf5_plugins
-
Dificultad 3/5 Medio día Aptitud para principiantes 45/100
HDFGroup/hdf5_plugins#288 ·
-
Reading ZSTD compressed HDF5 files in HDFView and/or ParaView with HDF5 ZSTD plugin on Windows causes heap failure and crashPosiblemente ocupada @lrknox la tomó hace 3 días. Abierto
HDFGroup/hdf5_plugins#289 · 7 comentarios · 1 asignado ·
-
Canonical name confirmation for H5Z_class3_t filter pluginsQuizá libre de nuevo @ajelenak la tomó hace 120 días y no hay ningún pull request abierto. Abierto
HDFGroup/hdf5_plugins#255 · 27 comentarios · 3 reacciones · 1 asignado ·
-
blosc2 fails to link on OpenBSDQuizá libre de nuevo @ajelenak la tomó hace 120 días y no hay ningún pull request abierto. AbiertoComponent - Build Filter - BLOSC(2)
HDFGroup/hdf5_plugins#252 · 1 comentario · 1 asignado ·
-
Bitround testing causes timeouts for Debug build of WindowsQuizá libre de nuevo @lrknox la tomó hace 210 días y no hay ningún pull request abierto. Abierto
HDFGroup/hdf5_plugins#239 · 1 asignado ·
Todos los issues de HDFGroup/hdf5_plugins
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/rocketmq-dashboard#6896 ·
Los mantenedores suelen responder en 3 días
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
data
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
gaseous-project/hasheous#637 ·
Los mantenedores suelen responder en 1 día
-
Grouping VCF export never writes the link INFO field (second link() replaces it)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug classification
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
SACGF/variantgrid#2259 ·
Los mantenedores suelen responder en 1 día