diff options
author | Jb Evain <jb@evain.net> | 2017-03-21 19:46:07 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-03-22 11:47:59 +0300 |
commit | 9a451b86a8b01fb1221fa1202ce2d52c438b7c65 (patch) | |
tree | 0bc127e3015d53b2444a096d68de31c04a2f9327 | |
parent | f41352fa7dce0162d3172004617121fe28f06a88 (diff) |
Add test for empty portable pdb
-rw-r--r-- | Mono.Cecil.PE/ImageReader.cs | 2 | ||||
-rw-r--r-- | Test/Mono.Cecil.Tests/PortablePdbTests.cs | 8 | ||||
-rw-r--r-- | Test/Resources/assemblies/EmptyPdb.dll | bin | 0 -> 3584 bytes | |||
-rw-r--r-- | Test/Resources/assemblies/EmptyPdb.pdb | bin | 0 -> 232 bytes |
4 files changed, 9 insertions, 1 deletions
diff --git a/Mono.Cecil.PE/ImageReader.cs b/Mono.Cecil.PE/ImageReader.cs index 6115f37..25ce54b 100644 --- a/Mono.Cecil.PE/ImageReader.cs +++ b/Mono.Cecil.PE/ImageReader.cs @@ -431,7 +431,7 @@ namespace Mono.Cecil.PE { uint offset = (uint) BaseStream.Position - table_heap_offset - image.MetadataSection.PointerToRawData; // header int stridx_size = image.StringHeap.IndexSize; - int guididx_size = image.GuidHeap.IndexSize; + int guididx_size = image.GuidHeap != null ? image.GuidHeap.IndexSize : 2; int blobidx_size = image.BlobHeap != null ? image.BlobHeap.IndexSize : 2; var heap = image.TableHeap; diff --git a/Test/Mono.Cecil.Tests/PortablePdbTests.cs b/Test/Mono.Cecil.Tests/PortablePdbTests.cs index 29637d0..c714d1d 100644 --- a/Test/Mono.Cecil.Tests/PortablePdbTests.cs +++ b/Test/Mono.Cecil.Tests/PortablePdbTests.cs @@ -353,6 +353,14 @@ namespace Mono.Cecil.Tests { } [Test] + public void EmptyPortablePdb () + { + TestModule ("EmptyPdb.dll", module => { + Assert.IsTrue (module.HasSymbols); + }, symbolReaderProvider: typeof (PortablePdbReaderProvider), symbolWriterProvider: typeof (PortablePdbWriterProvider)); + } + + [Test] public void PortablePdbLineInfo () { TestModule ("line.exe", module => { diff --git a/Test/Resources/assemblies/EmptyPdb.dll b/Test/Resources/assemblies/EmptyPdb.dll Binary files differnew file mode 100644 index 0000000..5360358 --- /dev/null +++ b/Test/Resources/assemblies/EmptyPdb.dll diff --git a/Test/Resources/assemblies/EmptyPdb.pdb b/Test/Resources/assemblies/EmptyPdb.pdb Binary files differnew file mode 100644 index 0000000..46e58d8 --- /dev/null +++ b/Test/Resources/assemblies/EmptyPdb.pdb |