public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/32904]  New: Typo in Base64.java's decode function
@ 2007-07-26 14:49 tjk at tksoft dot com
  2007-07-26 16:19 ` [Bug java/32904] " tromey at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: tjk at tksoft dot com @ 2007-07-26 14:49 UTC (permalink / raw)
  To: java-prs

There is a typo in libjava/classpath/gnu/java/security/util/Base64.java's
decode function.
public static byte[] decode(final byte[] src, final int off, final int len)
{... }

The following loop ends up throwing an exception on correct input.
A "continue" line is missing, as shown below.
When the continue line is added, the function works correctly.

for (i = off; i < off + len; i++)
      {
        sbiCrop = (byte) (src[i] & 0x7F); // Only the low seven bits
        sbiDecode = DECODABET[sbiCrop];
        if (sbiDecode >= WHITE_SPACE_ENC)
          { // White space, Equals sign or better
            if (sbiDecode >= EQUALS_SIGN_ENC)
              {
                b4[b4Posn++] = sbiCrop;
                if (b4Posn > 3)
                  {
                    outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn);
                    b4Posn = 0;
                    // If that was the equals sign, break out of 'for' loop
                    if (sbiCrop == EQUALS_SIGN)
                      break;
                  } // end if: quartet built
              } // end if: equals sign or better
            // ERROR HERE: The following line is missing.
            // continue;
          }
        throw new IllegalArgumentException("Illegal BASE-64 character at #"
                                           + i + ": " + src[i] + "(decimal)");
      }


-- 
           Summary: Typo in Base64.java's decode function
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tjk at tksoft dot com
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32904


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug java/32904] Typo in Base64.java's decode function
  2007-07-26 14:49 [Bug java/32904] New: Typo in Base64.java's decode function tjk at tksoft dot com
@ 2007-07-26 16:19 ` tromey at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-07-26 16:19 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from tromey at gcc dot gnu dot org  2007-07-26 16:19 -------
Note that this is fixed in Classpath and gcj 4.3.
As I recall, Casey (? I think) consolidated all the Base64
implementations into a single good one.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-26 16:19:36
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32904


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-26 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-26 14:49 [Bug java/32904] New: Typo in Base64.java's decode function tjk at tksoft dot com
2007-07-26 16:19 ` [Bug java/32904] " tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).