Skip to content

h5repack: fix silent loss of a declared cd_nelmts for UD filters#6466

Open
brtnfld wants to merge 2 commits into
HDFGroup:developfrom
brtnfld:fix/h5repack-ud-cd-nelmts
Open

h5repack: fix silent loss of a declared cd_nelmts for UD filters#6466
brtnfld wants to merge 2 commits into
HDFGroup:developfrom
brtnfld:fix/h5repack-ud-cd-nelmts

Conversation

@brtnfld

@brtnfld brtnfld commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #6462.

A declared cd_nelmts with no values following it (e.g. UD=<filtn>,<flag>,1) was never committed to filt->cd_nelmts in parse_filter(): the trailing token (the one with no comma after it) was always treated as a value, never checked against the l/f/p pending flags the way the comma-triggered branch already does. h5repack's own "incorrect number of compression parameters" validation then silently passed, since filt->cd_nelmts stayed at its memset default of 0 regardless of what the user actually wrote. The mismatch was only ever caught by coincidence, when the underlying filter plugin happened to do its own internal cd_values count check (see discussion on #6434).

  • Commits the trailing token to whichever UD field (filtn/filt_flag/cd_nelmts/value) is still pending, mirroring the comma-triggered branch.
  • Initializes l/f/p at declaration to clear a real -Wmaybe-uninitialized warning the change exposed (the compiler can't otherwise prove the UD branch that sets them was taken).
  • Adds a regression test (plugin_test_nelmts_no_values, UD=250,0,1) using filter 250, which has no internal validation, so the parser's own check is what's actually being exercised — the existing plugin_test_less test (UD=257,0,1) passed for the wrong reason (filter 257's internal check, not parse_filter()'s), and still does, but now for the right reason too.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

This PR touches the following areas. Each needs a sign-off
from its listed owners before merging.

A declared cd_nelmts with no values following it (e.g. UD=<filtn>,<flag>,1)
was never committed to filt->cd_nelmts: the trailing token (no comma after
it) was always treated as a value, never checked against the l/f/p pending
flags the way the comma-triggered branch does. h5repack's own validation
then silently passed since cd_nelmts stayed at its default 0, and the
mismatch was only ever caught by coincidence when the underlying filter
plugin did its own internal cd_values check (issue HDFGroup#6462).

Commit the trailing token to whichever UD field is still pending, mirroring
the comma-triggered branch exactly.
@brtnfld brtnfld force-pushed the fix/h5repack-ud-cd-nelmts branch from 12bdd80 to f750e26 Compare June 19, 2026 14:28
@brtnfld brtnfld requested review from jhendersonHDF and removed request for bmribler June 19, 2026 14:30
@hyoklee hyoklee moved this from To be triaged to In progress in HDF5 - TRIAGE & TRACK Jun 19, 2026
@hyoklee hyoklee added this to the HDF5 2.2.0 milestone Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

h5repack: UD filter parser silently drops a declared cd_nelmts when no values follow it

2 participants