From 1b685955cdfd5b21419e1e3f600255dca4e8b716 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sat, 24 Mar 2018 15:47:22 +1000 Subject: [PATCH] Fixes for WavReader to explictly handle "LIST" and "cue " chunks (RA2), and skip to EOF on unknown chunk --- OpenRA.Mods.Common/FileFormats/WavReader.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/FileFormats/WavReader.cs b/OpenRA.Mods.Common/FileFormats/WavReader.cs index 4fea9755b8..4931920975 100644 --- a/OpenRA.Mods.Common/FileFormats/WavReader.cs +++ b/OpenRA.Mods.Common/FileFormats/WavReader.cs @@ -46,6 +46,9 @@ namespace OpenRA.Mods.Common.FileFormats if ((s.Position & 1) == 1) s.ReadByte(); // Alignment + if (s.Position == s.Length) + break; // Break if we aligned with end of stream + var blockType = s.ReadASCII(4); switch (blockType) { @@ -75,9 +78,13 @@ namespace OpenRA.Mods.Common.FileFormats dataOffset = s.Position; s.Position += dataSize; break; + case "LIST": + case "cue ": + var listCueChunkSize = s.ReadInt32(); + s.ReadBytes(listCueChunkSize); + break; default: - var unknownChunkSize = s.ReadInt32(); - s.ReadBytes(unknownChunkSize); + s.Position = s.Length; // Skip to end of stream break; } }