You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Torsten Keim (JIRA)" <ji...@apache.org> on 2012/07/31 09:06:35 UTC

[jira] [Created] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Torsten Keim created SANTUARIO-334:
--------------------------------------

             Summary: UnsyncByteArrayOutputStream hangs on messages larger 512 MB
                 Key: SANTUARIO-334
                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
             Project: Santuario
          Issue Type: Bug
          Components: Java
    Affects Versions: Java 1.5.2
         Environment: Windows 7
            Reporter: Torsten Keim
            Assignee: Colm O hEigeartaigh


If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
The following lines show the endless loop:
while (newPos > newSize) {
 	newSize = newSize << 2;
}
Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
One solution would be to change the used types from int to long.

If we stay with datatype int, we could improve the implementation:
while (newPos > newSize) {
 	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
}
This would work with message up to 2 GB. Messages greater than 2 GB would still fail.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425676#comment-13425676 ] 

Colm O hEigeartaigh commented on SANTUARIO-334:
-----------------------------------------------


I applied a fix for this - could you test with the latest SNAPSHOT code? The loop now only doubles in size (rather than quadruples), and uses Integer.MAX_VALUE if newSize is less than zero. There are also separate checks to throw OutOfMemoryErrors.

Colm.
                
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh resolved SANTUARIO-334.
-------------------------------------------

    Resolution: Fixed
    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh updated SANTUARIO-334:
------------------------------------------

    Fix Version/s: Java 1.5.3
                   Java 1.4.8
    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh closed SANTUARIO-334.
-----------------------------------------

    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Torsten Keim (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13491445#comment-13491445 ] 

Torsten Keim commented on SANTUARIO-334:
----------------------------------------

Hi,

the fix works.

Thank you very much.

Bye 

                
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Torsten Keim (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13485903#comment-13485903 ] 

Torsten Keim commented on SANTUARIO-334:
----------------------------------------

Hi,
thank you for removing the comment containing my signature. We already took a look at the changed source (and it seems to be correct), but had no chance to test it yet. Today one of my colleagues will check it ... but at the moment he is dealing whit the problem to configure the JRE in such a way, that the Apache version is used and not the internal one of the JRE.
I'll send you a feedback as soon as we get it running. 

Torsten Keim

                
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh resolved SANTUARIO-334.
-------------------------------------------

    Resolution: Fixed
    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Torsten Keim (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13484917#comment-13484917 ] 

Torsten Keim commented on SANTUARIO-334:
----------------------------------------

Hi,

somehow the automatically sent reply mail of my Outlook went as comment into https://issues.apache.org/jira/browse/SANTUARIO-334 , but of course I don't want my signature to be published.
Could you please remove it from the there.

Thank you.
Torsten Keim


                
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Torsten Keim (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477016#comment-13477016 ] 

Torsten Keim commented on SANTUARIO-334:
----------------------------------------

Dear Ladies and Gentlemen,
Thank you for your message.
I am out of the office until October 22, 2012.

Please note: Your e-mail will not be forwarded automatically.
Kind regards,
Torsten Keim


Torsten Keim
Senior System Architect
T-Systems GEI GmbH
Systems Integration
Industry Application Solutions
Project Center Road Charging & Telematics
Vorgebirgsstraße 49, 53119 Bonn
Telefon: +49 228 9841 4209
Mobiltelefon: +49 171 555 0 765
E-Mail: torsten.keim@t-systems.com<ma...@t-systems.com>
Internet: http://www.t-systems.com<http://www.t-systems.com/>
T-Systems GEI GmbH
Aufsichtsrat: Ulrich Meister (Vorsitzender)
Geschäftsführung: Hans-Jörg Glaß (Vorsitzender), Jan Krellner
Handelsregister: Amtsgericht Aachen HRB 7106
Sitz der Gesellschaft: Aachen
Ust.-Id Nr. DE 811 137 130
Notice: This transmittal and/or attachments may be privileged or confidential. If you are not the intended recipient, you are hereby notified that you have received this transmittal in error; any review, dissemination, or copying is strictly prohibited.
If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you.



                
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh closed SANTUARIO-334.
-----------------------------------------

    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh updated SANTUARIO-334:
------------------------------------------

    Comment: was deleted

(was: Dear Ladies and Gentlemen,
Thank you for your message.
I am out of the office until October 22, 2012.

Please note: Your e-mail will not be forwarded automatically.
Kind regards,
Torsten Keim


Torsten Keim
Senior System Architect
T-Systems GEI GmbH
Systems Integration
Industry Application Solutions
Project Center Road Charging & Telematics
Vorgebirgsstraße 49, 53119 Bonn
Telefon: +49 228 9841 4209
Mobiltelefon: +49 171 555 0 765
E-Mail: torsten.keim@t-systems.com<ma...@t-systems.com>
Internet: http://www.t-systems.com<http://www.t-systems.com/>
T-Systems GEI GmbH
Aufsichtsrat: Ulrich Meister (Vorsitzender)
Geschäftsführung: Hans-Jörg Glaß (Vorsitzender), Jan Krellner
Handelsregister: Amtsgericht Aachen HRB 7106
Sitz der Gesellschaft: Aachen
Ust.-Id Nr. DE 811 137 130
Notice: This transmittal and/or attachments may be privileged or confidential. If you are not the intended recipient, you are hereby notified that you have received this transmittal in error; any review, dissemination, or copying is strictly prohibited.
If you received this transmittal in error, please notify us immediately by reply and immediately delete this message and all its attachments. Thank you.


)
    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Reopened] (SANTUARIO-334) UnsyncByteArrayOutputStream hangs on messages larger 512 MB

Posted by "Colm O hEigeartaigh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANTUARIO-334?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Colm O hEigeartaigh reopened SANTUARIO-334:
-------------------------------------------

    
> UnsyncByteArrayOutputStream hangs on messages larger 512 MB
> -----------------------------------------------------------
>
>                 Key: SANTUARIO-334
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-334
>             Project: Santuario
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: Java 1.5.2
>         Environment: Windows 7
>            Reporter: Torsten Keim
>            Assignee: Colm O hEigeartaigh
>             Fix For: Java 1.4.8, Java 1.5.3
>
>
> If we check the signature of a message larger than 512 MB, the method expandSize(int newPos) of class org.apache.xml.security.utils.UnsyncByteArrayOutputStream goes in an endless loop, i.e. it hangs.
> The following lines show the endless loop:
> while (newPos > newSize) {
>  	newSize = newSize << 2;
> }
> Initially the size is 8 KB and after several bit shifts by 2 (equal to multiplication with 4) the size is 512 MB. If 512 MB is multiplied with 4 it comes to an overflow: 512*1024*1024 << 2 = -2147483648, which is Integer.MIN_VALUE.
> One solution would be to change the used types from int to long.
> If we stay with datatype int, we could improve the implementation:
> while (newPos > newSize) {
>  	newSize = (newSize < (512*1024*1024)) ? (newSize << 2) :Integer.MAX_VALUE ;
> }
> This would work with message up to 2 GB. Messages greater than 2 GB would still fail.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira