dotnet / symstore

Implements API for retrieval of symbols and other debug artifacts from symbol store.
MIT License
143 stars 50 forks source link

Permanent exception in `Microsoft.FileFormats.PDB.PDBFile.ReadDirectory()` #400

Closed ww898 closed 1 year ago

ww898 commented 1 year ago

Microsoft.SymbolStore v1.0.405901 Windows 10 Pro 22H2 x64 Build 19045

Exception on parsing Windows PDB file, because one of stream sizes is 0xFFFFFFFF:

ERROR: System.AggregateException: One or more errors occurred. (Arithmetic operation resulted in an overflow.)
 ---> System.OverflowException: Arithmetic operation resulted in an overflow.
   at Microsoft.FileFormats.PDB.PDBFile.ToPageCount(UInt32 size)
   at Microsoft.FileFormats.PDB.PDBFile.CreatePagedAddressSpace(IAddressSpace indicesData, UInt64 offset, UInt32 length)
   at Microsoft.FileFormats.PDB.PDBFile.ReadDirectory()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.FileFormats.PDB.PDBFile.get_Streams()
   at Microsoft.FileFormats.PDB.PDBFile.<.ctor>b__5_2()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.FileFormats.PDB.PDBFile.get_DbiStream()
...

There is no any checking for streamSizes[i] here: https://github.com/dotnet/symstore/blob/65e1cd47410a80290b379c3d86c87415d5d07689/src/Microsoft.FileFormats/PDB/PDBFile.cs#L60-L61

P.S. v1.0.215101 has no errors!!!

mikem8361 commented 1 year ago

This has been fixed in PR #401.