Skip to content

Commit d8981e5

Browse files
committed
#101 - Added fix for chunks with odd-sized lengths
1 parent 85f6da9 commit d8981e5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/TagLib/Riff/File.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,16 @@ private void Read (bool read_tags, ReadStyle style,
478478
// Read until there are less than 8 bytes to read.
479479
do {
480480
bool tag_found = false;
481-
481+
482+
// Check if the current position is an odd number and increment it so it is even
483+
// This is done when the previous chunk size was an odd number.
484+
// If this is not done, the chunk being read after the odd chunk will not be read.
485+
if (position > 12 && (position & 1) != 0) { position++; }
486+
482487
Seek (position);
483488
string fourcc = ReadBlock (4).ToString (StringType.UTF8);
484489
size = ReadBlock (4).ToUInt (false);
485-
490+
486491
switch (fourcc)
487492
{
488493

0 commit comments

Comments
 (0)