Skip to content

Fix CodeQL format-specifier alerts in gumbo/error.c#4

Merged
deku2026 merged 1 commit into
mainfrom
worktree-fix-codeql-gumbo-error
May 18, 2026
Merged

Fix CodeQL format-specifier alerts in gumbo/error.c#4
deku2026 merged 1 commit into
mainfrom
worktree-fix-codeql-gumbo-error

Conversation

@deku2026
Copy link
Copy Markdown
Contributor

@deku2026 deku2026 commented May 18, 2026

Summary

  • GumboError.v.codepoint is declared uint64_t in gumbo/error.h, but gumbo_error_to_string formatted it with %x / %d, which expect unsigned int / int. This is undefined behavior on platforms where those widths differ and was flagged by CodeQL (cpp/wrong-type-format-argument).
  • Switched the four affected print_message calls to use PRIx64 / PRId64 from <inttypes.h> so the format specifier matches the argument width.

Fixes the following CodeQL alerts on main:

See: https://github.com/ArcForges/ArcNotes/security/code-scanning

Test plan

🤖 Generated with Claude Code

GumboError.v.codepoint is declared as uint64_t in error.h, but
gumbo_error_to_string formatted it with %x/%d, which expect
unsigned int/int. On platforms where these widths differ, this causes
undefined behavior and was flagged by CodeQL (cpp/wrong-type-format-argument).

Use the PRIx64/PRId64 macros from <inttypes.h> so the format specifiers
match the actual argument width.

Fixes CodeQL alerts #1, #2, #3, #4.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@deku2026 deku2026 merged commit 93e82fe into main May 18, 2026
8 checks passed
@deku2026 deku2026 deleted the worktree-fix-codeql-gumbo-error branch May 18, 2026 12:28
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