javaee / metro-jax-ws

https://javaee.github.io/metro-jax-ws/
Other
132 stars 68 forks source link

com.sun.xml.internal.messaging.saaj.util.Base64 broken for certain inputs #1228

Open LanceAndersen opened 6 years ago

LanceAndersen commented 6 years ago

Previously tracked via: https://bugs.openjdk.java.net/browse/JDK-6962582

FULL PRODUCT VERSION : java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065) Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)

ADDITIONAL OS VERSION INFORMATION : Windows XP Professional SP3 Darwin waldonbm-2.local 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386

A DESCRIPTION OF THE PROBLEM : Firstly, please move this bug report to the right location. I could not find the right sport for this issue.

For certain inputs, in specific - three consecutive ? characters (question mark) the Base64.encode() method fails.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : Compile the program attached and execute it.

EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - An encoded string ACTUAL - waldo@waldonbm Java $ java base64

???< [B@735cda3f< Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 63 at com.sun.xml.internal.messaging.saaj.util.Base64.encode(Base64.java:146) at base64.main(base64.java:8)

ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 63 at com.sun.xml.internal.messaging.saaj.util.Base64.encode(Base64.java:146) at base64.main(base64.java:8)

REPRODUCIBILITY : This bug can be reproduced always.

---------- BEGIN SOURCE ---------- import com.sun.xml.internal.messaging.saaj.util.Base64;

public class base64 { public static void main(String[] args) { String x = "???"; System.out.println(">"+x+"<"); System.out.println(">"+x.getBytes()+"<"); System.out.println(">"+Base64.encode(x.getBytes())+"<"); } }

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND : Use a 3rd party base64 encoder that does not fail under the input "???" or "????" or ...