The AI agent runs LLM-generated tool calls carrying frame numbers (startFrame, atFrame, toFrame, durationFrames, trim frames). These are only lower-bounded (>= 0 / >= 1), with no upper bound.
An integer near Int.max is finite (so it passes the decode-time finiteness check in decodeToolArgs) and fits in Int (so it decodes cleanly, unlike 1e19, which JSONDecoder rejects when decoding into Int). It then flows into startFrame + durationFrames (Clip.endFrame in Timeline.swift, clearRegion(end:), placeClip). Swift traps on Int overflow, and that trap is not catchable by the do/catch in ToolExecutor.execute, so the whole app crashes instead of returning a tool error.
This is the same failure class as the 1e19 overflow fixed in #201, resurfacing in the tools that were not routed through clampInt.
Reproduction
Via the agent / MCP:
add_clips { entries: [{ mediaRef: <any>, startFrame: 9223372036854775807, durationFrames: 60 }] }
Also reachable via insert_clips (atFrame), move_clips (toFrame), set_clip_properties (durationFrames/trims), add_texts, and apply_layout.
Notes
Confirmed against main (cdd63ff) with a test that drives add_clips at Int.max: the test process is killed with SIGTRAP the moment the tool runs. I have a small, test-backed fix ready if it would be useful.
The AI agent runs LLM-generated tool calls carrying frame numbers (
startFrame,atFrame,toFrame,durationFrames, trim frames). These are only lower-bounded (>= 0/>= 1), with no upper bound.An integer near
Int.maxis finite (so it passes the decode-time finiteness check indecodeToolArgs) and fits inInt(so it decodes cleanly, unlike1e19, whichJSONDecoderrejects when decoding intoInt). It then flows intostartFrame + durationFrames(Clip.endFrameinTimeline.swift,clearRegion(end:),placeClip). Swift traps onIntoverflow, and that trap is not catchable by thedo/catchinToolExecutor.execute, so the whole app crashes instead of returning a tool error.This is the same failure class as the
1e19overflow fixed in #201, resurfacing in the tools that were not routed throughclampInt.Reproduction
Via the agent / MCP:
Also reachable via
insert_clips(atFrame),move_clips(toFrame),set_clip_properties(durationFrames/trims),add_texts, andapply_layout.Notes
Confirmed against
main(cdd63ff) with a test that drivesadd_clipsatInt.max: the test process is killed with SIGTRAP the moment the tool runs. I have a small, test-backed fix ready if it would be useful.