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

Reply via email to