You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Stepan Mishura (JIRA)" <ji...@apache.org> on 2007/01/23 11:09:50 UTC
[jira] Assigned: (HARMONY-1148) [classlib][security] compatibility:
method MessageDigest.digest(..) throws different exception on RI and
Harmony
[ https://issues.apache.org/jira/browse/HARMONY-1148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stepan Mishura reassigned HARMONY-1148:
---------------------------------------
Assignee: Stepan Mishura (was: Mikhail Loenko)
> [classlib][security] compatibility: method MessageDigest.digest(..) throws different exception on RI and Harmony
> -----------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-1148
> URL: https://issues.apache.org/jira/browse/HARMONY-1148
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Vladimir Ivanov
> Assigned To: Stepan Mishura
> Priority: Minor
> Attachments: Harmony-1148-2.diff, Harmony-1148-3.diff, HARMONY-1148.diff
>
>
> The method MessageDigest.digest(byte[] buf, int offset, int len) thorws IllegalArgumentException for invalid params while RI throws DigestException/ ArrayIndexOutOfBoundsException.
> Seems, it may be marked as 'non-bug diff'.
> ====================== test.java =========================
> import java.security.*;
> public class test {
> public static void main (String[] args) {
> // len < 0
> try {
> MessageDigest.getInstance("SHA").digest(new byte[] {2,2}, 0, -1);
> } catch (Exception e) {
> e.printStackTrace();
> }
> // off < 0
> try {
> MessageDigest.getInstance("SHA").digest(new byte[] {2,2}, -100, 57);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> ======================================================
> Output:
> C:\tmp\tmp17>C:\jrockit-jdk1.5.0-windows-ia32\bin\java.exe -cp . -showversion test
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC: System optimized over throughput (initial strategy singleparpar))
> java.security.DigestException: Length must be at least 20 for SHA-1digests
> at sun.security.provider.DigestBase.engineDigest(DigestBase.java:152)
> at java.security.MessageDigest$Delegate.engineDigest(MessageDigest.java:536)
> at java.security.MessageDigest.digest(MessageDigest.java:336)
> at test.main(test.java:8)
> java.lang.ArrayIndexOutOfBoundsException
> at sun.security.provider.DigestBase.i2bBig(DigestBase.java:252)
> at sun.security.provider.SHA.implDigest(SHA.java:96)
> at sun.security.provider.DigestBase.engineDigest(DigestBase.java:161)
> at java.security.MessageDigest$Delegate.engineDigest(MessageDigest.java:536)
> at java.security.MessageDigest.digest(MessageDigest.java:336)
> at test.main(test.java:14)
> C:\tmp\tmp17>C:\harmony\classlib1.5\deploy\jdk\jre\bin\java.exe -cp . -showversion test
> java version 1.5 (subset)
> (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.digest(MessageDigest.java:25)
> at test.main(test.java:8)
> java.lang.IllegalArgumentException: Incorrect offset/len parameters
> at java.security.MessageDigest.digest(MessageDigest.java:25)
> at test.main(test.java:14)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.