[kaffe] CVS kaffe (kaz): libraries/javalib/java/io/ObjectInputStream.java
Kaffe CVS
Kaffe Mailing List <kaffe@kaffe.org>
Mon Feb 9 07:59:02 2004
PatchSet 4407
Date: 2004/02/09 15:56:22
Author: kaz
Branch: HEAD
Tag: (none)
Log:
2004-02-09 Ito Kazumitsu <kaz@maczuka.gcd.org>
* libraries/javalib/java/io/ObjectInputStream.java
(readClassDescriptor):
Avoid the overflow of fieldmapping.
Members:
ChangeLog:1.1991->1.1992
libraries/javalib/java/io/ObjectInputStream.java:1.31->1.32
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1991 kaffe/ChangeLog:1.1992
--- kaffe/ChangeLog:1.1991 Mon Feb 9 00:44:32 2004
+++ kaffe/ChangeLog Mon Feb 9 15:56:22 2004
@@ -1,3 +1,9 @@
+2004-02-09 Ito Kazumitsu <kaz@maczuka.gcd.org>
+
+ * libraries/javalib/java/io/ObjectInputStream.java
+ (readClassDescriptor):
+ Avoid the overflow of fieldmapping.
+
2004-02-08 Dalibor Topic <robilad@kaffe.org>
* Makefile.am (DIST_SUBDIRS): Removed intl.
Index: kaffe/libraries/javalib/java/io/ObjectInputStream.java
diff -u kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.31 kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.32
--- kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.31 Mon Feb 2 18:01:05 2004
+++ kaffe/libraries/javalib/java/io/ObjectInputStream.java Mon Feb 9 15:56:23 2004
@@ -491,7 +491,6 @@
ObjectStreamField[] stream_fields = osc.fields;
ObjectStreamField[] real_fields = ObjectStreamClass.lookup(clazz).fields;
ObjectStreamField[] fieldmapping = new ObjectStreamField[2 * Math.max(stream_fields.length, real_fields.length)];
- osc.fieldMapping = fieldmapping;
int stream_idx = 0;
int real_idx = 0;
@@ -543,9 +542,21 @@
}
if (real_field != null && !real_field.isToSet())
real_field = null;
+ /* If some of stream_fields does not correspond to any of real_fields,
+ * or the opposite, then fieldmapping will go short.
+ */
+ if (map_idx == fieldmapping.length)
+ {
+ ObjectStreamField[] newfieldmapping =
+ new ObjectStreamField[fieldmapping.length + 2];
+ System.arraycopy(fieldmapping, 0,
+ newfieldmapping, 0, fieldmapping.length);
+ fieldmapping = newfieldmapping;
+ }
fieldmapping[map_idx++] = stream_field;
fieldmapping[map_idx++] = real_field;
}
+ osc.fieldMapping = fieldmapping;
return osc;
}