harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ruth Cao (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1148) [classlib][security] compatibility: method MessageDigest.digest(..) throws different exception on RI and Harmony
Date Tue, 23 Jan 2007 09:53:49 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-1148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ruth Cao updated HARMONY-1148:
------------------------------

    Attachment: Harmony-1148-2.diff

Mikhail, 

May you pls try this new patch? Thanks a lot.

> [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: Mikhail Loenko
>            Priority: Minor
>         Attachments: Harmony-1148-2.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.


Mime
View raw message