Repository navigation
Commit 7316ef4
Reject oversized Syzygy symbol tables
`set_sizes()` reads the symbol count from the tablebase as a `u16`, but `btreeBuf`, `symlen` and `colour` have only `SymCount` (4096) entries. The existing `fits()` check bounds the source bytes, so a malformed table with a larger count can pass that check and overrun the destination in `memcpy()` and the subsequent symbol loop.
Reject counts greater than `SymCount` through the existing corrupt-table path before copying or iterating. Counts up to and including `SymCount` keep their existing handling. This applies to both WDL and DTZ loading.
Validation on macOS arm64 with Apple Clang:
- Optimized Apple silicon build; changed translation unit compiled with `-Werror`.
- All 75 upstream instrumented tests passed on a debug build with AddressSanitizer and UndefinedBehaviorSanitizer, including the Syzygy tests.
- Baseline and patched default benches both searched 1,559,611 nodes.
- `tests/signature.sh 1559611` and `git diff --check` passed.
The bounds error was identified and checked by source inspection; a malformed-tablebase runtime reproducer was not run. Windows and Linux validation remain for CI.
Prepared with OpenAI Codex, including source analysis and testing.
No functional change for valid tablebases.
closes #7237
No functional change1 parent 90fbc48 commit 7316ef4
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1208 | 1208 | | |
1209 | 1209 | | |
1210 | 1210 | | |
1211 | | - | |
| 1211 | + | |
1212 | 1212 | | |
1213 | 1213 | | |
1214 | 1214 | | |
| |||
0 commit comments