Do length checks in V/BSP

This commit is contained in:
Matt Nadareski
2024-11-27 21:05:04 -05:00
parent 14344756da
commit 25cc3e42f3
2 changed files with 2 additions and 2 deletions

View File

@@ -28,7 +28,7 @@ namespace SabreTools.Serialization.Deserializers
// Try to parse the header
var header = data.ReadType<BspHeader>();
if (header?.Lumps == null)
if (header?.Lumps == null || header.Lumps.Length != BSP_HEADER_LUMPS)
return null;
if (header.Version < 29 || header.Version > 30)
return null;

View File

@@ -32,7 +32,7 @@ namespace SabreTools.Serialization.Deserializers
return null;
if (Array.IndexOf([17, 18, 19, 20, 21, 22, 23, 25, 27, 29, 0x00040014], header.Version) > -1)
return null;
if (header.Lumps == null)
if (header.Lumps == null || header.Lumps.Length != VBSP_HEADER_LUMPS)
return null;
// Set the package header