Author: jbevain
Date: 2007-07-18 08:31:21 -0400 (Wed, 18 Jul 2007)
New Revision: 82199
Modified:
trunk/mcs/class/Mono.Cecil/ChangeLog
trunk/mcs/class/Mono.Cecil/Mono.Cecil.Metadata/StringsHeap.cs
trunk/mcs/class/Mono.Cecil/Mono.Cecil/AggressiveReflectionReader.cs
Log:
2007-07-18 Jb Evain <[EMAIL PROTECTED]>
* Mono.Cecil/AggressiveReflectionReader.cs:
Deal with out of range properties.
* Mono.Cecil.Metadata/StringsHeap.cs:
Deal with out of range string indexes.
Modified: trunk/mcs/class/Mono.Cecil/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Cecil/ChangeLog 2007-07-18 12:19:36 UTC (rev
82198)
+++ trunk/mcs/class/Mono.Cecil/ChangeLog 2007-07-18 12:31:21 UTC (rev
82199)
@@ -1,3 +1,10 @@
+2007-07-18 Jb Evain <[EMAIL PROTECTED]>
+
+ * Mono.Cecil/AggressiveReflectionReader.cs:
+ Deal with out of range properties.
+ * Mono.Cecil.Metadata/StringsHeap.cs:
+ Deal with out of range string indexes.
+
2007-07-17 Jb Evain <[EMAIL PROTECTED]>
* Mono.Cecil/AggressiveReflectionReader.cs:
Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil/AggressiveReflectionReader.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil/AggressiveReflectionReader.cs
2007-07-18 12:19:36 UTC (rev 82198)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil/AggressiveReflectionReader.cs
2007-07-18 12:31:21 UTC (rev 82199)
@@ -132,15 +132,22 @@
m_properties = new PropertyDefinition
[propsTable.Rows.Count];
for (int i = 0; i < pmapTable.Rows.Count; i++) {
PropertyMapRow pmapRow = pmapTable [i];
+ if (pmapRow.Parent == 0)
+ continue;
+
TypeDefinition owner = GetTypeDefAt
(pmapRow.Parent);
+
GenericContext context = new GenericContext
(owner);
- int start = (int) pmapRow.PropertyList, end;
+ int start = (int) pmapRow.PropertyList, last =
propsTable.Rows.Count + 1, end;
if (i < pmapTable.Rows.Count - 1)
end = (int) pmapTable [i +
1].PropertyList;
else
- end = propsTable.Rows.Count + 1;
+ end = last;
+ if (end > last)
+ end = last;
+
for (int j = start; j < end; j++) {
PropertyRow prow = propsTable [j - 1];
PropertySig psig =
m_sigReader.GetPropSig (prow.Type);
@@ -171,15 +178,21 @@
m_events = new EventDefinition [evtTable.Rows.Count];
for (int i = 0; i < emapTable.Rows.Count; i++) {
EventMapRow emapRow = emapTable [i];
+ if (emapRow.Parent == 0)
+ continue;
+
TypeDefinition owner = GetTypeDefAt
(emapRow.Parent);
GenericContext context = new GenericContext
(owner);
- int start = (int) emapRow.EventList, end;
+ int start = (int) emapRow.EventList, last =
evtTable.Rows.Count + 1, end;
if (i < (emapTable.Rows.Count - 1))
end = (int) emapTable [i + 1].EventList;
else
- end = evtTable.Rows.Count + 1;
+ end = last;
+ if (end > last)
+ end = last;
+
for (int j = start; j < end; j++) {
EventRow erow = evtTable [j - 1];
EventDefinition edef = new
EventDefinition (
Modified: trunk/mcs/class/Mono.Cecil/Mono.Cecil.Metadata/StringsHeap.cs
===================================================================
--- trunk/mcs/class/Mono.Cecil/Mono.Cecil.Metadata/StringsHeap.cs
2007-07-18 12:19:36 UTC (rev 82198)
+++ trunk/mcs/class/Mono.Cecil/Mono.Cecil.Metadata/StringsHeap.cs
2007-07-18 12:31:21 UTC (rev 82199)
@@ -29,7 +29,6 @@
namespace Mono.Cecil.Metadata {
using System.Collections;
- using System.IO;
using System.Text;
public class StringsHeap : MetadataHeap {
@@ -55,6 +54,9 @@
string ReadStringAt (uint index)
{
+ if (index > Data.Length - 1)
+ return string.Empty;
+
int length = 0;
for (int i = (int) index; i < Data.Length; i++) {
if (Data [i] == 0)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches