From b6cce50ccc5dbe8c110470dc3be2913cb292ce19 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Mon, 2 Dec 2013 17:52:03 +1300 Subject: [PATCH] Fix crash when loading 0x0 shps. Fixes #4192. --- OpenRA.FileFormats/Graphics/ShpReader.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRA.FileFormats/Graphics/ShpReader.cs b/OpenRA.FileFormats/Graphics/ShpReader.cs index b211b94751..a6e05e3546 100644 --- a/OpenRA.FileFormats/Graphics/ShpReader.cs +++ b/OpenRA.FileFormats/Graphics/ShpReader.cs @@ -108,6 +108,10 @@ namespace OpenRA.FileFormats void Decompress(Stream stream, ImageHeader h) { + // No extra work is required for empty frames + if (h.Size.Width == 0 || h.Size.Height == 0) + return; + if (recurseDepth > imageCount) throw new InvalidDataException("Format20/40 headers contain infinite loop");