You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/08/05 04:28:35 UTC
DO NOT REPLY [Bug 30483] New: -
Base64 decoder cast exception if byte sent in < 0
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30483>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30483
Base64 decoder cast exception if byte sent in < 0
Summary: Base64 decoder cast exception if byte sent in < 0
Product: Commons
Version: 1.0 Alpha
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Other
Component: Codec
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: junk@miginfocom.com
RFC 2045 stipulates that any unknown byte encountered during decoding should be
disregarded. All negative bytes sent to the decoder will produce the following
error though:
java.lang.ArrayIndexOutOfBoundsException: -62
at org.apache.commons.codec.binary.Base64.isBase64(Base64.java:137)
at org.apache.commons.codec.binary.Base64.discardNonBase64(Base64.java:478)
at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:374)
at TestCase.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at sun.reflect.DelegatingMethodAccessorImpl.
invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
Cuurent method:
private static boolean isBase64(byte octect) {
if (octect == PAD) {
return true;
} else if (base64Alphabet[octect] == -1) {
return false;
} else {
return true;
}
}
Fixed method:
private static boolean isBase64(byte octect) {
if (octect == PAD) {
return true;
} else if (octect < 0 || base64Alphabet[octect] == -1) {
return false;
} else {
return true;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org