From 99f366ad34e4c32abcee4d8c43112afa05b0e61e Mon Sep 17 00:00:00 2001 From: Chris Hemingway Date: Wed, 16 Jun 2021 18:26:30 +0100 Subject: [PATCH] Fix #101, make read_tags skip extra \0 bytes Some WAV files contain extra consecutive \0 bytes in RIFF INFO section, which causes issues if not skipped over properly. See #101 for details --- src/WAVChunk.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/WAVChunk.jl b/src/WAVChunk.jl index 5685377..6485927 100644 --- a/src/WAVChunk.jl +++ b/src/WAVChunk.jl @@ -222,8 +222,12 @@ function read_tag(tags::Dict{Symbol, String}, t::Vector{UInt8}) end tags[tag_id] = String(t[9:(i-1)]) - # Skip the null terminator - t[(i+1):end] + # Skip null terminator/s, repeat in case multiple are present + while t[i] == 0 && i < length(t) + i += 1 + end + # Return remainder of t + return t[i:end] end """