ironfede / openmcdf

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

System.OutOfMemoryException when reading corrupt Word document #40

Open Numpsy opened 5 years ago

Numpsy commented 5 years ago

Related to #30, but blowing up in a different location:

if you try to open the file out_of_memory_2.zip (generated by SharpFuzz) with the current OpenMcdf, you get a System.OutOfMemoryException with the call stack:

at System.Collections.Generic.List`1.set_Capacity(Int32 value)
   at System.Collections.Generic.List`1.EnsureCapacity(Int32 min)
   at System.Collections.Generic.List`1.Add(T item)
   at OpenMcdf.CompoundFile.GetDifatSectorChain()
   at OpenMcdf.CompoundFile.GetFatSectorChain()
   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.OutOfMemoryException : Array dimensions exceeded supported range.