[Mono-list] Bug in Mono.PEToolkit

Paulo Jorge F. Sacramento sacra@student.dei.uc.pt
Thu, 6 May 2004 14:18:22 +0100 (WEST)


Hi.

I've found a bug in Mono.PEToolkit and would really like to report it
somewhere. The problem is I can't find any suitable place to do it.
There's no Mono.PEToolkit component under Class Libraries in Bugzilla, so
I really don't know where to post my bug report.

The bug seems important to me as it happens in a lot of different
circumstances. It's currently preventing all my work from advancing, also
:(

I'll post it here in a short version, just so if anyone related to it
maybe can take care of it:

It only takes three instructions to reproduce it. Basically, I'm trying
to inspect some of .Net's core libraries with Mono:

using Mono.PEToolkit;
using Mono.PEToolkit.MetaData;

...

Image img = new
Image(@"c:\WINDOWS\Microsoft.Net\Framework\v1.1.4322\System.Web.dll");

img.Open();
img.ReadHeaders(); //This line crashes with a BadMetaDataException

Here's the stack trace:

Unhandled Exception: Mono.PEToolkit.Metadata.BadMetaDataException: Invalid
coded
 token for HasCustomAttribute, unknown table tag - 24
   at Mono.PEToolkit.Metadata.TabsDecoder.DecodeToken(CodedTokenId id,
Int32 dat
a)
   at Mono.PEToolkit.Metadata.CustomAttributeRow.FromRawData(Byte[] buff,
Int32
offs)
   at Mono.PEToolkit.Metadata.CustomAttributeTable.FromRawData(Byte[]
buff, Int3
2 offs, Int32 numRows)
   at Mono.PEToolkit.Metadata.TabsDecoder.DecodePhysicalTables(TablesHeap
heap,
Byte[] data, Int32 offs, Int32[] rows)
   at Mono.PEToolkit.Metadata.TablesHeap.FromRawData(Byte[] rawData)
   at Mono.PEToolkit.Metadata.MDHeap..ctor(MDStream stream)
   at Mono.PEToolkit.Metadata.TablesHeapBase..ctor(MDStream stream)
   at Mono.PEToolkit.Metadata.TablesHeap..ctor(MDStream stream)
   at Mono.PEToolkit.Metadata.MDHeap.Create(MDStream stream)
   at Mono.PEToolkit.Metadata.MDStream.InitHeap()
   at Mono.PEToolkit.Metadata.MDStream.get_Heap()
   at Mono.PEToolkit.Metadata.MetaDataRoot.Read(BinaryReader reader)
   at Mono.PEToolkit.Image.ReadHeaders()
   at PT.UC.DEI.DSG.Injector.Analyser.Main(String[] args) in
c:\estagio\injector
\analyser\analyser.cs:line 187


It's important to note that this happens in a lot of other assemblies
(I've tested it with at least 5), giving different reasons for the
BadMetaDataException and different table tags.

Thanks for your attention,

Paulo Sacramento

--
"Nobody realizes that some people expend tremendous energy merely to be
normal."

Albert Camus