mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-25 00:05:07 +00:00
Do length checks in V/BSP
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user