Skip to content

Sanitise BVM_ANIMATEACTOR speed and BVM_CREATEEMITTER offsets#239

Merged
CoreyRDean merged 1 commit into
developfrom
harden/bvm-emitter-animate-floats
May 25, 2026
Merged

Sanitise BVM_ANIMATEACTOR speed and BVM_CREATEEMITTER offsets#239
CoreyRDean merged 1 commit into
developfrom
harden/bvm-emitter-animate-floats

Conversation

@CoreyRDean
Copy link
Copy Markdown
Collaborator

Summary

Completes the BVM float-sanitisation sweep started in #237 / #238. Two more BVM commands broadcast script-supplied floats without clamping:

Site Param Use
BVM_ANIMATEACTOR Param3# anim speed P_AnimateActor wire — NaN locks up animation timer for that actor on each receiver
BVM_CREATEEMITTER Param5/6/7# offset coords P_CreateEmitter wire — NaN poisons emitter positioning

Both use ClampSaneFloat# (1e9 magnitude cap with NaN/Inf rejection) since emitter offsets and anim speeds are bounded small numbers, not world-space coords.

Test plan

  • compile.bat -t clean
  • CI green

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Completes the BVM float-sanitisation sweep started in #237/#238.
Two more BVM commands broadcast script-supplied floats without
clamping:

- BVM_ANIMATEACTOR (Param3# anim speed -> P_AnimateActor wire).
  NaN speed locks up the animation timer for that actor on each
  receiver.
- BVM_CREATEEMITTER (Param5/6/7# offset coords -> P_CreateEmitter
  wire). NaN offset poisons emitter positioning.

Both use ClampSaneFloat# (1e9 magnitude cap with NaN/Inf
rejection) since emitter offsets and anim speeds are bounded
small numbers, not world-space coords.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CoreyRDean CoreyRDean requested a review from a team as a code owner May 25, 2026 22:55
@CoreyRDean CoreyRDean merged commit 11605f7 into develop May 25, 2026
1 check passed
@CoreyRDean CoreyRDean deleted the harden/bvm-emitter-animate-floats branch May 25, 2026 22:56
CoreyRDean added a commit that referenced this pull request May 27, 2026
docs/modules/scripting.md (the already-existing runtime-half overview)
references docs/modules/scriptingcommands.md as the implementation-
half companion -- but the file didn't exist. Dangling link surfaced
during iteration #38 recon.

Wrote the module-level overview for ScriptingCommands.bb (~3300 lines,
222 BVM_* functions):

  * File-structure section table (~50-3300 grouped by theme: privilege
    helpers / actor lifecycle / items / spells / attributes / party /
    output / persistence / UDP). Refresh trigger when reorganization
    happens; navigation aid, not strict spec.

  * Privilege gating section consolidates the four CLAUDE.md gate
    categories, the clicker-handle trap (`SI\AI = Handle(clicker)`
    for Examine/Trade/RightClick/ItemScript), and the full
    currently-gated brick-vector cluster (11 functions with their
    threat shapes).

  * Dead-API surface (BVM_SETOWNER + BVM_SCENERYOWNER) -- references
    PR #297's stack-balance sentinel fix and the opcode-stability
    rationale for keeping the contract entries alive.

  * Float / integer hardening overview -- ClampWorldCoord# /
    ClampSaneFloat# and the bounds-check-before-array-index pattern.

  * Handle-Null discipline -- the canonical entry pattern that every
    BVM body must follow (Object.X(handle) returns Null for stale
    handles).

  * "Adding a new BVM function" three-file-lockstep procedure
    (ScriptingCommands.bb impl + RC_Standard_Invoker.bb contract +
    dispatch Case + RC_Standard.bcs compile-time twin), the
    alphabetical-opcode-shift gotcha, and the privilege-gate decision
    tree.

  * Notable historical hardening table cross-referencing PRs #260,
    #237-#239, #246-#248, #233/#234, #300, #301, #304.

  * Related-modules section linking back to scripting.md /
    bvm-reference.md / RC_Standard_Invoker.bb / RC_Standard.bcs /
    ServerNet.bb / BVMPrivilegeGateTest.bb / CLAUDE.md.

Closes the dangling-link gap; future scripting.md readers now have a
landing page for the implementation half. rc_standard_invoker.md is
still a dangling link from scripting.md -- deferred to a separate
iteration (it's more arcane; the BVM-reference auto-gen already
covers the user-facing API surface).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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