Skip to content

Commit 0bac3bc

Browse files
committed
X1a forward-stance-python#4 fix: JIT_CHECK_C loud-fail on phx_bc_offset_set_insert realloc OOM
Per theologian SR-3(a) 02:40:16Z catch on d5a9280. Original phx_bc_offset_set_insert had silent-skip on OOM realloc: s->data = (int *)realloc(s->data, new_cap * sizeof(int)); If OOM: s->data = NULL, capacity update succeeds, subsequent s->data[pos] = key crashes via NULL-deref instead of clean abort. Same class as W2-A1 silent-skip violation + gatekeeper forward stance python#4 codified rule (feedback_no_silent_bailout_in_helpers, supervisor 2026-04-30 20:10Z): BLOCK silent-return-on-malloc/resource-fail in Cat-A/B C helpers; loud-fail JIT_CHECK_C required regardless of tier. Fix (+5/-1 LOC): - Capture realloc result in new_data local before assigning to s->data - JIT_CHECK_C(new_data != NULL, "phx_bc_offset_set_insert realloc failed (new_cap=%zu)", new_cap) — loud-fail with diagnostic - Assign s->data = new_data only after the check - #include cinderx/Common/jit_log_c.h (matches builder_state_c.h pattern at line 31) Forward-fix per CLAUDE.md ("create NEW commit rather than amending"); d5a9280 stays as the X1a parent commit. Pre-commit chat-recheck applied per codified discipline; theologian flag at 02:40:16Z confirmed as latest disposition (no reversal).
1 parent d5a9280 commit 0bac3bc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎Python/jit/hir/phx_bc_offset_set.h‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <stdlib.h>
2727
#include <string.h>
2828

29+
#include "cinderx/Common/jit_log_c.h" /* JIT_CHECK_C loud-fail on realloc OOM */
30+
2931
#ifdef __cplusplus
3032
extern "C" {
3133
#endif
@@ -92,7 +94,11 @@ static inline int phx_bc_offset_set_insert(PhxBCOffsetSet *s, int key) {
9294
if (s->count + 1 > s->capacity) {
9395
size_t new_cap = s->capacity ? s->capacity * 2u
9496
: PHX_BC_OFFSET_SET_INITIAL_CAP;
95-
s->data = (int *)realloc(s->data, new_cap * sizeof(int));
97+
int *new_data = (int *)realloc(s->data, new_cap * sizeof(int));
98+
JIT_CHECK_C(new_data != NULL,
99+
"phx_bc_offset_set_insert realloc failed (new_cap=%zu)",
100+
new_cap);
101+
s->data = new_data;
96102
s->capacity = new_cap;
97103
}
98104
if (pos < s->count) {

0 commit comments

Comments
 (0)
Sponsor
SponsoredKunjungi sekarang
Promo