This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


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

Re: java/3426: java.io.InputStreamReader, infinite loop


The following reply was made to PR libgcj/3426; it has been noted by GNATS.

From: Tom Tromey <tromey@redhat.com>
To: david-b@pacbell.net
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: java/3426: java.io.InputStreamReader, infinite loop
Date: 29 Jun 2001 16:57:54 -0600

 >>>>> "David" == david-b  <david-b@pacbell.net> writes:
 
 David> The for(;;) loop in the second half of
 David> java.io.InputStreamReader will loop infinitely in the following
 David> case:
 
 I looked at this and I agree.  The problem is that the
 InputStreamReader has no way to force the BufferedInputStream to
 refill its buffer.  So in your scenario, instead of making progress
 we simply keep trying the same thing over and over.
 
 One fix might be to make BufferedInputStream.refill package-private
 and then call it from InputStreamReader.read while the mark is set.
 This is pretty ugly.  It is hard to see what else we could do
 without rewriting InputStreamReader.  I'd prefer not to do that,
 I think.
 
 David> "FIXME:  what if R == -1 ?" comment which seems like it
 David> is what's being hit here.
 
 We definitely have to do something smarter if we hit an encoding
 error.  Maybe throwing CharConversionException is appropriate?
 We currently don't throw that anywhere, which seems odd.
 I think we ought to throw it if we detect garbage in the input
 stream.  What do you think?
 
 Tom


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