This is the mail archive of the java-discuss@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Is serialization broken?


On Sat, 27 Jan 2001, Bryce McKinlay wrote:

> Warren Levy wrote:
> 
> > Well, it seems that java.io.DataInputStream.readInt is throwing an
> > EOFException because it is mistakenly reading some negative data to mean
> > EOF.  I was able to jump past the check for the negative value in the
> > debugger and the program ran to completion just fine.
> 
> Ouch. Now that I look at this, my DataInputStream patch from classpath should
> go in. It will re-merge the implementations and ought to fix this bug.

That may help but I think that ObjectInputStream.read() is the real
problem.

It takes an element of a byte array and returns it as an int (so it can
accidently get sign-extended).  I haven't checked this, but my guess is
that it should be AND'ing with 0xFF (and there should be a try/catch of
EOFException so that it can return -1 if EOFException is thrown from
below).
 
> > Breakpoint 2, java.util.HashMap.readObject (this=@8101fc8, s=@8086400)
> >     at /home/warrenl/egcs/libjava/java/util/HashMap.java:639
> > 639         s.defaultReadObject();
> 
> Hmm... do you have a magic GDB that can demange new-ABI java symbols? I'm
> using the latest gdb from cvs, which seems to work quite nicely, but it
> doesn't demangle. I was planning to make an attempt to fix this, but don't
> want to duplicate someone elses effort.

Nah, for debugging purposes, I'm still using a tree built with the old
ABI so I'm not running into this.
--warrenl


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]