solver: check completion before probing square #19

Merged
mcp merged 2 commits from codex/issue-14-completion-check into main 2026-07-30 16:54:09 +01:00
Collaborator

Summary

  • add a focused completed-board solver regression for orders 1 and 8
  • independently validate both returned solutions
  • check the next_pos() end sentinel before calling largest_square()

Commit structure

  1. test: cover completed solver boards — old code fails under ASan with a heap-buffer-overflow
  2. solver: check completion before probing square — minimal ordering fix

Testing

  • Debug CTest: 5/5 passed
  • Release CTest: 5/5 passed
  • ASan CTest: 5/5 passed
  • UBSan CTest: 5/5 passed
  • order-8 output is unchanged across the fix

Review

Independent review found no issues and reproduced both the old Debug assertion/ASan overflow and the fixed Debug/ASan suites. This also completes the feasible end-to-end independent validation prepared in #1.

Closes #14
Part of #16

## Summary - add a focused completed-board solver regression for orders 1 and 8 - independently validate both returned solutions - check the `next_pos()` end sentinel before calling `largest_square()` ## Commit structure 1. `test: cover completed solver boards` — old code fails under ASan with a heap-buffer-overflow 2. `solver: check completion before probing square` — minimal ordering fix ## Testing - Debug CTest: 5/5 passed - Release CTest: 5/5 passed - ASan CTest: 5/5 passed - UBSan CTest: 5/5 passed - order-8 output is unchanged across the fix ## Review Independent review found no issues and reproduced both the old Debug assertion/ASan overflow and the fixed Debug/ASan suites. This also completes the feasible end-to-end independent validation prepared in #1. Closes #14 Part of #16
mcp added 2 commits 2026-07-30 16:54:04 +01:00
Exercise both the trivial order-1 solution and the feasible order-8 solution through the independent placement validator.

With the existing completion ordering, the focused test reports a heap-buffer-overflow under AddressSanitizer before validation can run.

Refs: #14
next_pos() returns the grid end sentinel when a placement completes the board. Avoid passing that sentinel to largest_square(), which requires an in-range position and otherwise reads past the grid.

Tests: Debug, Release, ASan, and UBSan CTest suites

Refs: #14
mcp merged commit ce39d0a4d0 into main 2026-07-30 16:54:09 +01:00
mcp deleted branch codex/issue-14-completion-check 2026-07-30 16:54:10 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mgrettondann/partridge-cpp#19