directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <directory-...@incubator.apache.org>
Subject [jira] Updated: (DIRSNICKERS-103) Bad encoding of tags number above 127
Date Sat, 19 Feb 2005 02:24:49 GMT
     [ http://issues.apache.org/jira/browse/DIRSNICKERS-103?page=history ]

Emmanuel Lecharny updated DIRSNICKERS-103:
------------------------------------------

    Attachment: asn1-ber.diff

Here are corrections for the issue. All the asn1-ber test are successful, with wome kind of
weird messages, which seems to be "expected" errors ... :

[elecharny@wkslx01 ber]$ maven test
 __  __
|  \/  |__ _Apache__ ___
| |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
|_|  |_\__,_|\_/\___|_||_|  v. 1.0.2

Attempting to download asn1-codec-0.3-SNAPSHOT.jar.
Attempting to download ldap-common-0.9-SNAPSHOT.jar.
Attempting to download ldap-snacc-provider-0.9-SNAPSHOT.jar.
build:start:

java:prepare-filesystem:

java:compile:
    [echo] Compiling to /home/elecharny/apache-ds-good/asn1/trunk/ber/target/classes
    [echo]
==========================================================

  NOTE: Targetting JVM 1.4, classes
  will not run on earlier JVMs

==========================================================


java:jar-resources:

test:prepare-filesystem:

test:test-resources:

test:compile:

test:test:    
    [junit] Running org.apache.asn1.ber.BERDecoderCallbackAdapterTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.027 sec
    [junit] Running org.apache.asn1.ber.SimplePrimitiveTLVTests
    [junit] Tests run: 3, Failures: 0, Errors: 0, Time elapsed: 0.11 sec
    [junit] Running org.apache.asn1.ber.ConstructedTLVTests
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.049 sec
    [junit] Running org.apache.asn1.ber.MultiByteTagTests
    [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 0.051 sec
    [junit] Running org.apache.asn1.ber.SingleByteLengthTests
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.123 sec
    [junit] Running org.apache.asn1.ber.SingleByteTagTests
    [junit] Tests run: 37, Failures: 0, Errors: 0, Time elapsed: 0.058 sec
    [junit] Running org.apache.asn1.ber.EncodeDecodeTests
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.142 sec
    [junit] Running org.apache.asn1.ber.MultiByteLengthTests
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.112 sec
    [junit] Running org.apache.asn1.ber.BEREncoderTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.033 sec
    [junit] Running org.apache.asn1.ber.BERDecoderStateTest
    [junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 0.028 sec
    [junit] Running org.apache.asn1.ber.LengthTest
    [junit] Tests run: 6, Failures: 0, Errors: 0, Time elapsed: 0.006 sec
    [junit] Running org.apache.asn1.ber.LdapMessageTests
    [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 0.207 sec
    [junit] Running org.apache.asn1.ber.TypeClassTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.019 sec
    [junit] Running org.apache.asn1.ber.TupleTreeDecoderTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 0.122 sec
    [junit] Running org.apache.asn1.ber.TupleTest
    [junit] Tests run: 24, Failures: 0, Errors: 0, Time elapsed: 0.027 sec
    [junit] Running org.apache.asn1.ber.digester.BERDigesterTest

Error while triggering rule org.apache.asn1.ber.digester.BERDigesterTest$ErrorRule@c67a88
with digester org.apache.asn1.ber.digester.BERDigester@96ad7c: Rule.tag() threw error
java.lang.Error
        at org.apache.asn1.ber.digester.BERDigesterTest$ErrorRule.tag(BERDigesterTest.java:939)
        at org.apache.asn1.ber.digester.BERDigester.fireTagEvent(BERDigester.java:1033)
        at org.apache.asn1.ber.digester.BERDigester$DigesterCallback.tagDecoded(BERDigester.java:164)
        at org.apache.asn1.ber.BERDecoder.fireTagDecoded(BERDecoder.java:357)
        at org.apache.asn1.ber.BERDecoder.decodeOccurred(BERDecoder.java:274)
        at org.apache.asn1.codec.stateful.AbstractStatefulDecoder.decodeOccurred(AbstractStatefulDecoder.java:130)
        at org.apache.asn1.ber.TagDecoder.decode(TagDecoder.java:57)
        at org.apache.asn1.ber.BERDecoder.decode(BERDecoder.java:153)
        at org.apache.asn1.ber.digester.BERDigester.decode(BERDigester.java:145)        
        at org.apache.asn1.ber.digester.BERDigesterTest.testErrorOnTag(BERDigesterTest.java:552)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
... 
(lines and lines and lines)
... 
        at java.lang.reflect.Method.invoke(Method.java:324)
        at com.werken.forehead.Forehead.run(Forehead.java:551)
        at com.werken.forehead.Forehead.main(Forehead.java:581)
    [junit] Tests run: 29, Failures: 0, Errors: 0, Time elapsed: 358.463 sec
    [junit] Running org.apache.asn1.ber.digester.TagTreeTest
    [junit] Tests run: 13, Failures: 0, Errors: 0, Time elapsed: 0.026 sec
    [junit] Running org.apache.asn1.ber.digester.rules.ByteAccumulatorTest
    [junit] Tests run: 8, Failures: 0, Errors: 0, Time elapsed: 0.011 sec
    [junit] Running org.apache.asn1.ber.digester.rules.PrimitiveOctetStringRuleTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.128 sec
    [junit] Running org.apache.asn1.ber.digester.rules.PrimitiveIntDecodeRuleTest
    [junit] Tests run: 18, Failures: 0, Errors: 0, Time elapsed: 0.125 sec
    [junit] Running org.apache.asn1.ber.digester.RulesBaseTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 0.12 sec
    [junit] Running org.apache.asn1.ber.digester.TagNodeTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.004 sec
    [junit] Running org.apache.asn1.ber.TagTest
    [junit] Tests run: 9, Failures: 0, Errors: 0, Time elapsed: 0.376 sec
    [junit] Running org.apache.asn1.ber.DefaultMutableTupleNodeTest
    [junit] Tests run: 28, Failures: 0, Errors: 0, Time elapsed: 0.044 sec
    [junit] Running org.apache.asn1.ber.BERDecoderTest
    [junit] Tests run: 11, Failures: 0, Errors: 0, Time elapsed: 0.043 sec
    [junit] Running org.apache.asn1.ber.primitives.PrimitiveUtilsTest
    [junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.105 sec
BUILD SUCCESSFUL
Total time: 13 seconds
Finished at: Sat Feb 19 03:12:28 CET 2005


> Bad encoding of tags number above 127
> -------------------------------------
>
>          Key: DIRSNICKERS-103
>          URL: http://issues.apache.org/jira/browse/DIRSNICKERS-103
>      Project: Directory Snickers
>         Type: Bug
>   Components: BER Runtime
>     Versions: 0.2.0
>     Reporter: Emmanuel Lecharny
>     Assignee: Alex Karasulu
>     Priority: Minor
>  Attachments: asn1-ber.diff
>
> Tere is a bug in functions :
> org.apache.asn1.ber.Tag.getTagId(byte[])
> and 
> org.apache.asn1.ber.Tag.getTagId(TagOctetCollector)
> when the tag has a number above 127 - which may be very unlikely to happen ! -. In this
case, bytes are decoded in the revert order :
>  ...
>         // calculate tag value w/ long tag format
>         for( int ii = 1 ; ii < octets.length; ii++ )
>         {
>             int shift = ( ii - 1 ) * 7 ;
>             id |= ( octets[ii] & LONG_MASK ) << shift ;
>         }
>  ...
> should be :
>  ...
>         // calculate tag value w/ long tag format
>         for ( int ii = 1; ii < octets.length; ii++ )
>         {
>             id = (id << 7) | (octets[ii] & LONG_MASK);
>         }
>  ...
> in both functions. 
> The test case should also be corrected, as value are create din the revert order in test

> org.apache.asn1.bertestGetTagIdByteArray() :
> ...
>             octets[1] = (byte)(ii & Tag.LONG_MASK);
>             octets[2] = (byte)((ii >> 7) & Tag.LONG_MASK);
> ...
> should be :
> ...
>             octets[1] = (byte)((ii >> 7) & Tag.LONG_MASK);
>             octets[2] = (byte)(ii & Tag.LONG_MASK);
> ...
> and
> ...
>             octets[1] = (byte)(ii & Tag.LONG_MASK);
>             octets[2] = (byte)((ii >> 7) & Tag.LONG_MASK);
>             octets[3] = (byte)((ii >> 14) & Tag.LONG_MASK);
> ...
> should be :
> ...
>             octets[1] = (byte)((ii >> 14) & Tag.LONG_MASK);
>             octets[2] = (byte)((ii >> 7) & Tag.LONG_MASK);
>             octets[3] = (byte)(ii & Tag.LONG_MASK);
> ...
> Function org.apache.asn1.ber.Tag.getTagId(int) seems to works correctly - although not
tested.

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message