Skip to content
This repository was archived by the owner on Aug 20, 2026. It is now read-only.
This repository was archived by the owner on Aug 20, 2026. It is now read-only.

bug: heap-buffer-overflow in RLS weight-neighbourhood read (matvec_bending_rls -> stencil.h load_wnbr -> stap.h smag) #67

Description

@balbasty

Agent:claude-fastfields-to-teeny

Found during fastfields-cpu-impl#49's review (kernels#50 phase 4), confirmed as pre-existing — same family as kernels#39 (the OOB wget read that #39/kernels#61 already fixed for a different call path).

The bug

ASan reports a heap-buffer-overflow reading one element past the wgt buffer, via matvec_bending_rlsregularisers/stencil.h's load_wnbrstap.h:121's smag. Reproduced over the fastfields-cpu-impl#49/#50 differential sweep (all batch shapes, padded strides, D ∈ {1,2,3}) — clean on 7 of 9 instantiable field/flow sites, but field relax_bending_rls_/relax_bending_jrls_ (the two sites that reach matvec_bending_rls) trip it every time.

Confirmed identical on old and new code — same stap.h:121 smag frame, same address, on both the pre- and post-refactor reg_field.h. Not introduced by the impl-layer relax refactor; it's a kernel-layer read past the weight buffer's bounds in the RLS neighbourhood-magnitude accessor.

Scope

Not fixed in cpu-impl#49/#50 (impl-layer refactor, wrong layer for a kernel-layer buffer-bounds bug, and out of that PR's stated scope). Needs its own fix in fastfields-kernels/stap.h/regularisers/stencil.h's smag/load_wnbr, likely a bounds-check gate similar to what closed kernels#39 for a sibling read path. Also relevant to fastfields-cpu-lib#66 (field_relax unreachable/untested) and fastfields-cpu-impl#51 (the two sites that trip this are the same two with the wrong colour-loop bound) — all three converge on "field's RLS/JRLS bending relax path has never been exercised by a real test."


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions