Skip to content

Reject malformed AGG/BAGG headers before construction - #971

Merged
tturocy merged 1 commit into
gambitproject:masterfrom
d-kad:fix-agg-bagg-segfault
Jul 3, 2026
Merged

Reject malformed AGG/BAGG headers before construction#971
tturocy merged 1 commit into
gambitproject:masterfrom
d-kad:fix-agg-bagg-segfault

Conversation

@d-kad

@d-kad d-kad commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Resolves a pre-existing crash surfaced by CI

Description of the changes in this PR

Fixes a segfault in the AGG/BAGG file readers on malformed input.

Cause: malformed input (e.g. an .nfg to read_bagg, or a degenerate "0 0 0" header)
slipped past the header checks and dereferenced an empty vector in the AGG constructor, segfaulting.
The parser code is unchanged from master and runs before any label normalization.

Fix: validate header fields before construction; malformed headers now raise ValueError, valid files are unaffected.

Tests: test_read_agg_zero_header / test_read_bagg_zero_header read "0 0 0\n" and expect ValueError.
These segfault on unpatched code (taking down the pytest process, as in CI) rather than failing as an assertion.

@d-kad d-kad added this to the gambit-16.7.0 milestone Jul 3, 2026
@d-kad d-kad added c++ Items which involve writing in C++ bug labels Jul 3, 2026
@tturocy
tturocy merged commit 5482aaa into gambitproject:master Jul 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug c++ Items which involve writing in C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants