Skip to content

tool_help: rectify a bad assert#21837

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/help-assert
Closed

tool_help: rectify a bad assert#21837
bagder wants to merge 1 commit into
masterfrom
bagder/help-assert

Conversation

@bagder

@bagder bagder commented Jun 2, 2026

Copy link
Copy Markdown
Member

The condition was wrong, and now it also verifies 'tlen'.

Reported-by: Gao Liyou
Ref: #21825

The condition was wrong, and now it also verifies 'tlen'.

Reported-by: Gao Liyou
Ref: #21825
@bagder bagder requested a review from Copilot June 2, 2026 06:26
@bagder bagder marked this pull request as ready for review June 2, 2026 06:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes an incorrect debug-time bounds assertion in the tool help “manual scan” logic (src/tool_help.c) by requiring all relevant scan token lengths to fit within the rolling buffer, and additionally validating the trigger length (tlen) which is used by the rolling memmove() window.

Changes:

  • Replace an incorrect DEBUGASSERT condition that used || with a correct && check.
  • Extend the assertion to also verify ctx->tlen fits within ctx->rbuf.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder closed this in 7d2382e Jun 2, 2026
@bagder bagder deleted the bagder/help-assert branch June 2, 2026 06:47
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
The condition was wrong, and now it also verifies 'tlen'.

Reported-by: Gao Liyou
Ref: curl#21825
Closes curl#21837
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants