Skip to content

v5: Handle case of vsprintf returning oob pointer offset. - #3061

Merged
Rot127 merged 1 commit into
capstone-engine:v5from
Rot127:v5-vsnprintf
Sep 2, 2026
Merged

Rot127 merged 1 commit into
capstone-engine:v5from
Rot127:v5-vsnprintf

Conversation

@Rot127

@Rot127 Rot127 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Your checklist for this pull request

  • I've documented or updated the documentation of every API function and struct this PR changes.
  • I've added tests that prove my fix is effective or that my feature works (if possible)

Detailed description

Backport of #3060

Test plan

...

Closing issues

...

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The newly added bounds check should be adjusted to avoid signed/unsigned comparison (and available - 1 underflow patterns) to prevent warnings or Werror build failures.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Backport of #3060 to harden SKIPDATA operand-string generation against abnormal vsnprintf/cs_snprintf return values that could otherwise lead to out-of-bounds pointer arithmetic.

Changes:

  • Add an early error/length check after the initial cs_snprintf() in skipdata_opstr() to prevent advancing p / reducing available on invalid lengths.
File summaries
File Description
cs.c Adds a guard for cs_snprintf return values to avoid OOB pointer/length updates when formatting SKIPDATA operand strings.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cs.c
@Rot127
Rot127 merged commit 51360da into capstone-engine:v5 Sep 2, 2026
24 checks passed
@Rot127
Rot127 deleted the v5-vsnprintf branch September 2, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CS-core-files auto-sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants