From fe66afa58071e7140aea7dfaf86cfce9e846a124 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Thu, 3 Jun 2021 12:52:37 +0100 Subject: [PATCH] Guard against reading beyond partition end when identifying UNICOS filesystem. Fixes #581 --- Aaru.Filesystems/UNICOS.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Aaru.Filesystems/UNICOS.cs b/Aaru.Filesystems/UNICOS.cs index 91ab3b9c9..49589dc3f 100644 --- a/Aaru.Filesystems/UNICOS.cs +++ b/Aaru.Filesystems/UNICOS.cs @@ -75,6 +75,9 @@ namespace Aaru.Filesystems if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0) sbSize++; + if(partition.Start + sbSize >= partition.End) + return false; + byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize); if(sector.Length < Marshal.SizeOf())