Skip to content

Commit 3a0996b

Browse files
authored
debug
1 parent f47e68b commit 3a0996b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

SabreTools.Serialization/Readers/ISO9660.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,10 @@ public static List<PathTableGroup> ParsePathTableGroup(Stream data, short sector
649649

650650
// Validate extent length
651651
if (extentLength <= 0 || extentFinal > (long)data.Length)
652+
{
653+
Console.WriteLine($"ERROR0: {extentLength} <= 0 || {extentFinal} > {(long)data.Length}");
652654
return null;
655+
}
653656

654657
// Move stream to directory location
655658
data.SeekIfPossible(extentOffset, SeekOrigin.Begin);
@@ -664,7 +667,10 @@ public static List<PathTableGroup> ParsePathTableGroup(Stream data, short sector
664667
// Start of directory should not be 0
665668
int firstRecordLength = data.PeekByteValue();
666669
if (firstRecordLength == 0)
670+
{
671+
Console.WriteLine($"ERROR1: {firstRecordLength} != 0");
667672
return null;
673+
}
668674

669675
// Read all directory records in this directory
670676
var records = new List<DirectoryRecord>();
@@ -688,7 +694,10 @@ public static List<PathTableGroup> ParsePathTableGroup(Stream data, short sector
688694
// Start of sector should not be 0, ignore entire directory
689695
int nextRecordLength = data.PeekByteValue();
690696
if (nextRecordLength <= paddingLength)
697+
{
698+
Console.WriteLine($"ERROR2: {nextRecordLength} <= {paddingLength}");
691699
return null;
700+
}
692701

693702
continue;
694703
}
@@ -705,7 +714,10 @@ public static List<PathTableGroup> ParsePathTableGroup(Stream data, short sector
705714
// Compare recordLength with number of bytes in directoryRecord and return null if mismatch
706715
var readLength = 33 + directoryRecord.FileIdentifier.Length + (directoryRecord.PaddingField == null ? 0 : 1) + directoryRecord.SystemUse.Length;
707716
if (readLength != recordLength)
717+
{
718+
Console.WriteLine($"ERROR3: {readLength} != {recordLength}");
708719
return null;
720+
}
709721

710722
records.Add(directoryRecord);
711723
}

0 commit comments

Comments
 (0)