[NTFS] Guard against too big non-resident data sizes.

This commit is contained in:
2026-03-30 12:55:44 +01:00
parent 15c7276af1
commit c2c1999f33

View File

@@ -535,6 +535,13 @@ public sealed partial class NTFS
/// <returns>Error number indicating success or failure.</returns>
ErrorNumber ReadNonResidentData(List<(long offset, long length)> dataRuns, long dataSize, ref byte[] buf)
{
if(dataSize > int.MaxValue)
{
AaruLogging.Debug(MODULE_NAME, "Non-resident data size {0} exceeds maximum array size", dataSize);
return ErrorNumber.OutOfRange;
}
buf = new byte[dataSize];
long bytesRead = 0;