Skip to content

fix: bounds-check tigris_mem_load_tile height window to fail closed on out-of-range rows - #36

Merged
asteinh merged 2 commits into
developfrom
feature/load-tile-bounds-failclosed
Aug 17, 2026
Merged

fix: bounds-check tigris_mem_load_tile height window to fail closed on out-of-range rows#36
asteinh merged 2 commits into
developfrom
feature/load-tile-bounds-failclosed

Conversation

@asteinh

@asteinh asteinh commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

tigris_mem_load_tile did not bounds-check its [h_start, h_end) row window against the
source tensor height, so a malformed or mis-tiled plan requesting rows outside [0, H]
would read past the tensor (an out-of-bounds read). tigris_mem_load_tile_2d already has
this guard; this adds the matching one to the 1D primitive.

Defense-in-depth companion to the compiler fail-closed guard for a post-spatial strided
external skip: the runtime never OOB-reads even on a hand-built or future plan.

Change

  • tigris_mem_load_tile: if (h_start < 0 || h_end <= h_start || h_end > H) return TIGRIS_MEM_ERR_BAD_INDEX;, mirroring tigris_mem_load_tile_2d. The caller
    (exec_stage_tiled) already propagates the error.
  • Test test_load_tile_1d_rejects_bad_bounds: a valid h_end == H window still loads;
    negative h_start, h_end == h_start, and h_end > H are rejected. Without the guard
    the negative case SIGSEGVs; with it, the test passes.

Testing

test_tile_2d: 409 passed. Runtime unit tests green. ASan/UBSan clean on the load_tile
exercisers (test_tile_2d, test_executor, test_row_offset). Stack-usage gate run locally.

@asteinh
asteinh merged commit f7a4114 into develop Aug 17, 2026
18 checks passed
@asteinh
asteinh deleted the feature/load-tile-bounds-failclosed branch August 17, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant