ironfede / openmcdf

Microsoft Compound File .net component - pure C# - netstandard 2.0
Mozilla Public License 2.0
297 stars 73 forks source link

System.ArgumentOutOfRangeException take 2 #39

Closed Numpsy closed 5 years ago

Numpsy commented 5 years ago

If you try to load the attached corrupt_doc.zip with the current OpenMCDF source (containing the previous OutOfRange fixes), you get an ArgumentOutOfRangeException with the call stack

Result StackTrace:  
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at OpenMcdf.StreamView.Read(Byte[] buffer, Int32 offset, Int32 count)
   at OpenMcdf.StreamView.ReadInt32()
   at OpenMcdf.CompoundFile.GetNormalSectorChain(Int32 secID)
   at OpenMcdf.CompoundFile.LoadDirectories()
   at OpenMcdf.CompoundFile.Load(Stream stream)
   at OpenMcdf.CompoundFile..ctor(Stream stream)

Result Message: 
System.ArgumentOutOfRangeException : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

(The test file was generated by SharpFuzz)

Numpsy commented 5 years ago

Think this one is sorted now.