NokiaTube | New address | Mode Phone | On high quality
Skip to content

Fix zero-frame reads for RIFF and RIFX WAVs over 4 GiB - #1202

Closed
aaalgo wants to merge 1 commit into
mackron:devfrom
aaalgo:fix/large-wav-data-size
Closed

aaalgo wants to merge 1 commit into
mackron:devfrom
aaalgo:fix/large-wav-data-size

Conversation

@aaalgo

@aaalgo aaalgo commented Nov 19, 2026

Copy link
Copy Markdown

Problem

RIFF and RIFX WAV files that use 0xFFFFFFFF as the data chunk size can report zero PCM frames when the audio payload exceeds 4 GiB. The file-size probe leaves the stream at EOF, so the fallback scan reads zero bytes.

Fix

When the file size is available, calculate the data size from the file size and the data chunk offset. When a fallback scan is still needed, seek back to the start of the data chunk before reading.

Verification

  • Tested sparse RIFF and RIFX WAVs with payloads over 4 GiB. Both reported zero frames before the fix. With the fix, both reported the expected frame count and returned the expected first PCM sample.
  • Confirmed that ordinary and truncated WAVs still report the expected frame count and return the expected first sample.

@mackron

mackron commented Nov 19, 2026

Copy link
Copy Markdown
Owner

This is originating from dr_wav. I have fixed this manually upstream and updated both the dev and dev-0.12 branches.

@mackron mackron closed this Nov 19, 2026
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.

2 participants