Skip to content

Commit 2c60fa8

Browse files
authored
Merge pull request #132 from MichelZ/mize/improve_uniqueid
Improve unique sector index validation
2 parents 7926818 + ab465fa commit 2c60fa8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sources/OpenMcdf/CompoundFile.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,12 +1325,15 @@ int nextSecID
13251325

13261326
private void EnsureUniqueSectorIndex(int nextSecID, HashSet<int> processedSectors)
13271327
{
1328-
if (processedSectors.Contains(nextSecID) && this.validationExceptionEnabled)
1328+
if (!this.validationExceptionEnabled)
13291329
{
1330-
throw new CFCorruptedFileException("The file is corrupted.");
1330+
return;
13311331
}
13321332

1333-
processedSectors.Add(nextSecID);
1333+
if (!processedSectors.Add(nextSecID))
1334+
{
1335+
throw new CFCorruptedFileException("The file is corrupted.");
1336+
}
13341337
}
13351338

13361339
/// <summary>

0 commit comments

Comments
 (0)