fix: harden XS safety (empty AV guard, runtime null check)#73
Draft
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Draft
fix: harden XS safety (empty AV guard, runtime null check)#73Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Koan-Bot wants to merge 1 commit intocpan-authors:mainfrom
Conversation
Contributor
|
@Koan-Bot rebase |
Three defensive improvements to the XS layer: 1. DEFGV macro: guard against AvMAX returning -1 on empty arrays, which caused negative pointer arithmetic (fixes cpan-authors#66) 2. Replace assert(gl_overload_ft) with a runtime croak in all four OP handlers — asserts are compiled away under NDEBUG (fixes cpan-authors#69) 3. Replace hardcoded `13` with `STAT_T_MAX` constant in _stat_for() to match the rest of the codebase (fixes cpan-authors#65) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
Rebase: fix: harden XS safety (empty AV guard, runtime null check)Branch Diff: 1 file changed, 10 insertions(+), 9 deletions(-) Review feedback was analyzed and applied. Actions
CICI will be checked asynchronously. Automated by Kōan |
fb8ae87 to
3005451
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three defensive hardening fixes in the XS layer addressing issues #66, #69, and #65.
Why
RETURN_CALL_REAL_OP_IF_CALL_WITH_DEFGVdoesarg + AvMAX(arg)without checking for empty arrays.AvMAXreturns -1 for empty AVs, producing negative pointer arithmetic that reads from unintended memory.gl_overload_ftviaassert(), which compiles to nothing underNDEBUG(typical for distribution builds). A null deref at OP dispatch crashes the interpreter._stat_forhardcodes13instead of usingSTAT_T_MAX#65:_stat_forhardcodes13instead of using theSTAT_T_MAXconstant already available.How
AvMAX >= 0precondition before the pointer arithmetic in the DEFGV macro.assert(gl_overload_ft)withASSERT_OVERLOAD_FT_INITIALIZED()macro that croaks unconditionally in all build configurations.(0) x 13with(0) x STAT_T_MAXin_stat_for().Testing
Full test suite: 1250 tests pass (55 test files).
🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 11 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (0 Tests)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline