From 26f75d4e68a98ff28eac792b4ee7189b28c03b45 Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Mon, 1 Sep 2025 16:33:36 -0500 Subject: [PATCH] fix: tui attachment bound (#2361) --- packages/tui/internal/app/prompt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/tui/internal/app/prompt.go b/packages/tui/internal/app/prompt.go index 8701a207..bd5086a4 100644 --- a/packages/tui/internal/app/prompt.go +++ b/packages/tui/internal/app/prompt.go @@ -43,6 +43,9 @@ func (p Prompt) ToMessage( } for _, att := range textAttachments { if source, ok := att.GetTextSource(); ok { + if att.StartIndex > att.EndIndex || att.EndIndex > len(text) { + continue + } text = text[:att.StartIndex] + source.Value + text[att.EndIndex:] } }