Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tomas-Kraus opened this issue Jun 2, 2022 · 0 comments · Fixed by #212
Closed

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

Tomas-Kraus opened this issue Jun 2, 2022 · 0 comments · Fixed by #212

Comments

@Tomas-Kraus
Copy link
Member

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 ...

Source: javaee/metro-jax-ws#1228
Author: LanceAndersen

@lukasj lukasj transferred this issue from eclipse-ee4j/metro-jax-ws Jun 9, 2022
sephiroth-j added a commit to sephiroth-j/metro-saaj that referenced this issue May 3, 2023
…ce it with `java.util.Base64`

closes eclipse-ee4j#202

Signed-off-by: Ronny Perinke <23166289+sephiroth-j@users.noreply.github.com>
lukasj pushed a commit that referenced this issue May 11, 2023
…ce it with `java.util.Base64`

closes #202

Signed-off-by: Ronny Perinke <23166289+sephiroth-j@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant