You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Petteri Stenius <Pe...@ubisecure.com> on 2004/10/05 10:50:00 UTC

InclusiveNamespaces and StringIndexOutOfBoundsException

The CVS HEAD version of xml-security causes a StringIndexOutOfBoundsException in InclusiveNamespaces.java.

Find attached a suggested fix to the InclusiveNamespaces.prefixStr2Set method. The fix simply reverts a breaking change in r1.6 of
InclusiveNamespaces.java.

Petteri


Re: InclusiveNamespaces and StringIndexOutOfBoundsException

Posted by Raul Benito <ra...@r-bg.com>.
Petteri Stenius wrote:

>Ok. Here's the stacktrace.
>
>
>------------------------------------------------------------------------
>
>java.lang.StringIndexOutOfBoundsException: String index out of range: -4
>	at java.lang.String.substring(Unknown Source)
>	at java.lang.String.substring(Unknown Source)
>	at org.apache.xml.security.transforms.params.InclusiveNamespaces.<init>(InclusiveNamespaces.java:89)
>	at org.apache.xml.security.transforms.params.InclusiveNamespaces.<init>(InclusiveNamespaces.java:64)
>	at Main.sign(Main.java:77)
>	at Main.main(Main.java:40)
>  
>
Thanks a lot, it was very helpful. I have committed the fix it should be 
now correct in CVS.
Regards and sorry for the annoyances.

Raul
http://r-bg.com

RE: InclusiveNamespaces and StringIndexOutOfBoundsException

Posted by Petteri Stenius <Pe...@ubisecure.com>.
Ok. Here's the stacktrace.

Petteri

-----Original Message-----
From: Raul Benito [mailto:raul-info@r-bg.com]
Sent: Tuesday, October 05, 2004 2:40 PM
To: security-dev@xml.apache.org
Subject: Re: InclusiveNamespaces and StringIndexOutOfBoundsException


Petteri Stenius wrote:

>The CVS HEAD version of xml-security causes a StringIndexOutOfBoundsException in InclusiveNamespaces.java.
>
>Find attached a suggested fix to the InclusiveNamespaces.prefixStr2Set method. The fix simply reverts a breaking change in r1.6 of
>InclusiveNamespaces.java.
>
>Petteri
>
>  
>
>------------------------------------------------------------------------
>
>Index: src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java
>===================================================================
>RCS file: /home/cvspublic/xml-security/src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java,v
>retrieving revision 1.6
>diff -u -r1.6 InclusiveNamespaces.java
>--- src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java	3 Aug 2004 18:01:22 -0000	1.6
>+++ src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java	5 Oct 2004 08:39:31 -0000
>@@ -151,7 +151,7 @@
>          if (prefix.equals("#default")) {
>             prefixes.add("xmlns" );
>          } else {
>-            prefixes.add( prefix);
>+            prefixes.add("xmlns:" + prefix);
>          }
>       }
> 
>  
>

Thanks for the change,but it is not going to work as the c14n methods 
don't expect xmlns:prefix anymore(just prefix, is faster and you don't 
create garbage on the way). Can you send us the backtrace and the inputs 
so I can take a look more carefully where it fails.

Thanks,

Raul

Re: InclusiveNamespaces and StringIndexOutOfBoundsException

Posted by Raul Benito <ra...@r-bg.com>.
Petteri Stenius wrote:

>The CVS HEAD version of xml-security causes a StringIndexOutOfBoundsException in InclusiveNamespaces.java.
>
>Find attached a suggested fix to the InclusiveNamespaces.prefixStr2Set method. The fix simply reverts a breaking change in r1.6 of
>InclusiveNamespaces.java.
>
>Petteri
>
>  
>
>------------------------------------------------------------------------
>
>Index: src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java
>===================================================================
>RCS file: /home/cvspublic/xml-security/src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java,v
>retrieving revision 1.6
>diff -u -r1.6 InclusiveNamespaces.java
>--- src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java	3 Aug 2004 18:01:22 -0000	1.6
>+++ src/org/apache/xml/security/transforms/params/InclusiveNamespaces.java	5 Oct 2004 08:39:31 -0000
>@@ -151,7 +151,7 @@
>          if (prefix.equals("#default")) {
>             prefixes.add("xmlns" );
>          } else {
>-            prefixes.add( prefix);
>+            prefixes.add("xmlns:" + prefix);
>          }
>       }
> 
>  
>

Thanks for the change,but it is not going to work as the c14n methods 
don't expect xmlns:prefix anymore(just prefix, is faster and you don't 
create garbage on the way). Can you send us the backtrace and the inputs 
so I can take a look more carefully where it fails.

Thanks,

Raul