dotnet / symstore

Implements API for retrieval of symbols and other debug artifacts from symbol store.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ww898 opened this issue · comments

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:

streams[i] = new Reader(CreatePagedAddressSpace(directoryContent, position, streamSizes[i]));
position += ToPageCount(streamSizes[i]) * sizeof(uint);

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

This has been fixed in PR #401.