Skip to content

Conversation

@lenzo-ka
Copy link
Contributor

Description

Fixes a stack-buffer overflow vulnerability when logging 4-byte WAV chunk IDs in ps_config_wavfile.

The issue occurs when processing malformed WAV files with unknown chunks. The code used %s format specifier with a non-null-terminated char[4] buffer, which could read past the buffer boundary during logging.

Changes:

  • Replaced %s format specifier with %c%c%c%c
  • Pass individual characters id[0], id[1], id[2], id[3] to prevent buffer over-read

Verification steps

  • Compiled successfully with no errors
  • Prevents AddressSanitizer stack-buffer-overflow reported in the issue
  • All other uses of the id buffer use safe operations (memcmp with explicit length)

Fixes #431

Replace unsafe %s format specifier with %c%c%c%c to prevent
reading past the 4-byte non-null-terminated id buffer.

Fixes #431
@lenzo-ka lenzo-ka requested a review from dhdaines October 23, 2025 18:21
@dhdaines dhdaines merged commit 5619ada into main Oct 23, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Stack-buffer over-read when logging 4-byte WAV chunk IDs in ps_config_wavfile

2 participants