You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Denis Kishenko (JIRA)" <ji...@apache.org> on 2006/08/09 13:40:13 UTC
[jira] Created: (HARMONY-1120) [class][security]
MessageDigest.update(byte[], int, int) incompatible with RI exceptions
[class][security] MessageDigest.update(byte[], int, int) incompatible with RI exceptions
----------------------------------------------------------------------------------------
Key: HARMONY-1120
URL: http://issues.apache.org/jira/browse/HARMONY-1120
Project: Harmony
Issue Type: Bug
Components: Non-bug differences from RI
Reporter: Denis Kishenko
Seems like RI doesn't check if offset and len are negative but Harmony does, so we have difference in behavior.
------------------------------------ Test -------------------------------------------
import java.security.MessageDigest;
public class bug9429 {
public static void main (String[] args) {
// len <0; RI does not throw exception
try {
System.err.println("1");
MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, -100);
} catch (Exception e) {
e.printStackTrace();
}
// RI and Harmony throws IllegalArgumentException
try {
System.err.println("2");
MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, 5);
} catch (Exception e) {
e.printStackTrace();
}
// RI throws ArrayIndexOutOfBoundsException; Harmony throws IllegalArgumentException
// off <0
try {
System.err.println("3");
MessageDigest.getInstance("SHA").update(new byte[] {2,2}, -100, 57);
} catch (Exception e) {
e.printStackTrace();
}
}
}
------------------------ Output ----------------------------------------
RI
1
2
java.lang.IllegalArgumentException: Input buffer too short
at java.security.MessageDigest.update(MessageDigest.java:267)
at bug9429.main(bug9429.java:16)
3
java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:120)
at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:523)
at java.security.MessageDigest.update(MessageDigest.java:269)
at bug9429.main(bug9429.java:24)
Harmony
1
java.lang.IllegalArgumentException: Incorrect offset/len parameters
at java.security.MessageDigest.update(MessageDigest.java:169)
at bug9429.main(bug9429.java:9)
2
java.lang.IllegalArgumentException: Incorrect offset/len parameters
at java.security.MessageDigest.update(MessageDigest.java:169)
at bug9429.main(bug9429.java:16)
3
java.lang.IllegalArgumentException: Incorrect offset/len parameters
at java.security.MessageDigest.update(MessageDigest.java:169)
at bug9429.main(bug9429.java:24)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-1120) [class][security]
MessageDigest.update(byte[], int, int) incompatible with RI exceptions
Posted by "Denis Kishenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1120?page=all ]
Denis Kishenko updated HARMONY-1120:
------------------------------------
Attachment: 1120-MessageDigestTest.patch
> [class][security] MessageDigest.update(byte[], int, int) incompatible with RI exceptions
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-1120
> URL: http://issues.apache.org/jira/browse/HARMONY-1120
> Project: Harmony
> Issue Type: Bug
> Components: Non-bug differences from RI
> Reporter: Denis Kishenko
> Attachments: 1120-MessageDigest.patch, 1120-MessageDigestTest.patch
>
>
> Seems like RI doesn't check if offset and len are negative but Harmony does, so we have difference in behavior.
> ------------------------------------ Test -------------------------------------------
> import java.security.MessageDigest;
> public class bug9429 {
> public static void main (String[] args) {
> // len <0; RI does not throw exception
> try {
> System.err.println("1");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, -100);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI and Harmony throws IllegalArgumentException
> try {
> System.err.println("2");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, 5);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI throws ArrayIndexOutOfBoundsException; Harmony throws IllegalArgumentException
> // off <0
> try {
> System.err.println("3");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, -100, 57);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> ------------------------ Output ----------------------------------------
> RI
> 1
> 2
> java.lang.IllegalArgumentException: Input buffer too short
> at java.security.MessageDigest.update(MessageDigest.java:267)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:120)
> at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:523)
> at java.security.MessageDigest.update(MessageDigest.java:269)
> at bug9429.main(bug9429.java:24)
> Harmony
> 1
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:9)
> 2
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:24)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (HARMONY-1120) [class][security]
MessageDigest.update(byte[], int, int) incompatible with RI exceptions
Posted by "Mikhail Loenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1120?page=all ]
Mikhail Loenko reassigned HARMONY-1120:
---------------------------------------
Assignee: Mikhail Loenko
> [class][security] MessageDigest.update(byte[], int, int) incompatible with RI exceptions
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-1120
> URL: http://issues.apache.org/jira/browse/HARMONY-1120
> Project: Harmony
> Issue Type: Bug
> Components: Non-bug differences from RI
> Reporter: Denis Kishenko
> Assigned To: Mikhail Loenko
> Attachments: 1120-MessageDigest.patch, 1120-MessageDigestTest.patch
>
>
> Seems like RI doesn't check if offset and len are negative but Harmony does, so we have difference in behavior.
> ------------------------------------ Test -------------------------------------------
> import java.security.MessageDigest;
> public class bug9429 {
> public static void main (String[] args) {
> // len <0; RI does not throw exception
> try {
> System.err.println("1");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, -100);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI and Harmony throws IllegalArgumentException
> try {
> System.err.println("2");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, 5);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI throws ArrayIndexOutOfBoundsException; Harmony throws IllegalArgumentException
> // off <0
> try {
> System.err.println("3");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, -100, 57);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> ------------------------ Output ----------------------------------------
> RI
> 1
> 2
> java.lang.IllegalArgumentException: Input buffer too short
> at java.security.MessageDigest.update(MessageDigest.java:267)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:120)
> at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:523)
> at java.security.MessageDigest.update(MessageDigest.java:269)
> at bug9429.main(bug9429.java:24)
> Harmony
> 1
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:9)
> 2
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:24)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-1120) [class][security]
MessageDigest.update(byte[], int, int) incompatible with RI exceptions
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1120?page=all ]
Tim Ellison updated HARMONY-1120:
---------------------------------
Component/s: Classlib
(was: Non-bug differences from RI)
> [class][security] MessageDigest.update(byte[], int, int) incompatible with RI exceptions
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-1120
> URL: http://issues.apache.org/jira/browse/HARMONY-1120
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
> Assigned To: Mikhail Loenko
> Attachments: 1120-MessageDigest.patch, 1120-MessageDigestTest.patch
>
>
> Seems like RI doesn't check if offset and len are negative but Harmony does, so we have difference in behavior.
> ------------------------------------ Test -------------------------------------------
> import java.security.MessageDigest;
> public class bug9429 {
> public static void main (String[] args) {
> // len <0; RI does not throw exception
> try {
> System.err.println("1");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, -100);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI and Harmony throws IllegalArgumentException
> try {
> System.err.println("2");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, 5);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI throws ArrayIndexOutOfBoundsException; Harmony throws IllegalArgumentException
> // off <0
> try {
> System.err.println("3");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, -100, 57);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> ------------------------ Output ----------------------------------------
> RI
> 1
> 2
> java.lang.IllegalArgumentException: Input buffer too short
> at java.security.MessageDigest.update(MessageDigest.java:267)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:120)
> at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:523)
> at java.security.MessageDigest.update(MessageDigest.java:269)
> at bug9429.main(bug9429.java:24)
> Harmony
> 1
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:9)
> 2
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:24)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (HARMONY-1120) [class][security]
MessageDigest.update(byte[], int, int) incompatible with RI exceptions
Posted by "Denis Kishenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1120?page=all ]
Denis Kishenko updated HARMONY-1120:
------------------------------------
Attachment: 1120-MessageDigest.patch
path+test
According to discussion [1] of this issue I make Harmony behavior the same as RI. Please change "Component" field from "Non-bug" to "Classlib".
[1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200609.mbox/%3cb266b8670609040610r10bba2ebh3db1ef926ecff179@mail.gmail.com%3e
> [class][security] MessageDigest.update(byte[], int, int) incompatible with RI exceptions
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-1120
> URL: http://issues.apache.org/jira/browse/HARMONY-1120
> Project: Harmony
> Issue Type: Bug
> Components: Non-bug differences from RI
> Reporter: Denis Kishenko
> Attachments: 1120-MessageDigest.patch, 1120-MessageDigestTest.patch
>
>
> Seems like RI doesn't check if offset and len are negative but Harmony does, so we have difference in behavior.
> ------------------------------------ Test -------------------------------------------
> import java.security.MessageDigest;
> public class bug9429 {
> public static void main (String[] args) {
> // len <0; RI does not throw exception
> try {
> System.err.println("1");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, -100);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI and Harmony throws IllegalArgumentException
> try {
> System.err.println("2");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, 0, 5);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // RI throws ArrayIndexOutOfBoundsException; Harmony throws IllegalArgumentException
> // off <0
> try {
> System.err.println("3");
> MessageDigest.getInstance("SHA").update(new byte[] {2,2}, -100, 57);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> ------------------------ Output ----------------------------------------
> RI
> 1
> 2
> java.lang.IllegalArgumentException: Input buffer too short
> at java.security.MessageDigest.update(MessageDigest.java:267)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.ArrayIndexOutOfBoundsException
> at java.lang.System.arraycopy(Ljava.lang.Object;ILjava.lang.Object;II)V(Unknown Source)
> at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:120)
> at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:523)
> at java.security.MessageDigest.update(MessageDigest.java:269)
> at bug9429.main(bug9429.java:24)
> Harmony
> 1
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:9)
> 2
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:16)
> 3
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.update(MessageDigest.java:169)
> at bug9429.main(bug9429.java:24)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira