You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "StarBreeze (JIRA)" <ji...@apache.org> on 2008/01/10 12:15:05 UTC

[jira] Created: (WW-2412) Include tag is not safe (as result of the bug in FastByteArrayOutputStream)

Include tag is not safe (as result of the bug in FastByteArrayOutputStream)
---------------------------------------------------------------------------

                 Key: WW-2412
                 URL: https://issues.apache.org/struts/browse/WW-2412
             Project: Struts 2
          Issue Type: Bug
    Affects Versions: 2.0.11
         Environment: tomcat 6, windows or linux
            Reporter: StarBreeze


There is no activity on WW-826 and I cannot reopen it, so I am creting new issue.

Struts include tag uses the FastByteArrayOutputStream class that copies content of included JSP into the response stream by constant sized char blocks.
But UTF-8 symbols have different length in bytes. You cannot split a byte stream until you exactly know lengths of it char parts (in bytes). 
As alternative, you may copy bytes, but DO NOT DO new String(bytes, encoding).
Seems the second approach is not applicable to the char's http response. 

There is the good patch already: http://jira.atlassian.com/browse/JRA-13866 
It solves the problem. 

The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols in the included JSP (JSP must be included by the struts include tag). Both parent and included JSPs must have contentType="text/html; charset=UTF-8". 
In this situation you may see two garbage symbols on the joint of two buffer rendering result. Looks very unpleasant..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-2412) Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown resolved WW-2412.
---------------------------

    Resolution: Fixed
      Assignee: Don Brown

Thanks Brad for the code and not forgetting us s2 folks :)

> Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)
> ---------------------------------------------------------------------------------------------
>
>                 Key: WW-2412
>                 URL: https://issues.apache.org/struts/browse/WW-2412
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>         Environment: tomcat 6, windows or linux
>            Reporter: StarBreeze
>            Assignee: Don Brown
>             Fix For: 2.1.1
>
>
> There is no activity on WW-826 and I cannot reopen it, so I am creting new issue.
> Struts include tag uses the FastByteArrayOutputStream class that copies content of included JSP into the response stream by constant sized char blocks.
> But UTF-8 symbols have different length in bytes. You cannot split a byte stream until you exactly know lengths of it char parts (in bytes). 
> As alternative, you may copy bytes, but DO NOT DO new String(bytes, encoding).
> Seems the second approach is not applicable to the char's http response. 
> There is the good patch already: http://jira.atlassian.com/browse/JRA-13866 
> It solves the problem. 
> The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols in the included JSP (JSP must be included by the struts include tag). Both parent and included JSPs must have contentType="text/html; charset=UTF-8". 
> In this situation you may see two garbage symbols on the joint of two buffer rendering result. Looks very unpleasant..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2412) Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Don Brown updated WW-2412:
--------------------------

    Fix Version/s: 2.1.1

> Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)
> ---------------------------------------------------------------------------------------------
>
>                 Key: WW-2412
>                 URL: https://issues.apache.org/struts/browse/WW-2412
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>         Environment: tomcat 6, windows or linux
>            Reporter: StarBreeze
>             Fix For: 2.1.1
>
>
> There is no activity on WW-826 and I cannot reopen it, so I am creting new issue.
> Struts include tag uses the FastByteArrayOutputStream class that copies content of included JSP into the response stream by constant sized char blocks.
> But UTF-8 symbols have different length in bytes. You cannot split a byte stream until you exactly know lengths of it char parts (in bytes). 
> As alternative, you may copy bytes, but DO NOT DO new String(bytes, encoding).
> Seems the second approach is not applicable to the char's http response. 
> There is the good patch already: http://jira.atlassian.com/browse/JRA-13866 
> It solves the problem. 
> The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols in the included JSP (JSP must be included by the struts include tag). Both parent and included JSPs must have contentType="text/html; charset=UTF-8". 
> In this situation you may see two garbage symbols on the joint of two buffer rendering result. Looks very unpleasant..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WW-2412) Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)

Posted by "StarBreeze (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

StarBreeze updated WW-2412:
---------------------------

    Summary: Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)  (was: Include tag is not safe (as result of the bug in FastByteArrayOutputStream))

> Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)
> ---------------------------------------------------------------------------------------------
>
>                 Key: WW-2412
>                 URL: https://issues.apache.org/struts/browse/WW-2412
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>         Environment: tomcat 6, windows or linux
>            Reporter: StarBreeze
>
> There is no activity on WW-826 and I cannot reopen it, so I am creting new issue.
> Struts include tag uses the FastByteArrayOutputStream class that copies content of included JSP into the response stream by constant sized char blocks.
> But UTF-8 symbols have different length in bytes. You cannot split a byte stream until you exactly know lengths of it char parts (in bytes). 
> As alternative, you may copy bytes, but DO NOT DO new String(bytes, encoding).
> Seems the second approach is not applicable to the char's http response. 
> There is the good patch already: http://jira.atlassian.com/browse/JRA-13866 
> It solves the problem. 
> The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols in the included JSP (JSP must be included by the struts include tag). Both parent and included JSPs must have contentType="text/html; charset=UTF-8". 
> In this situation you may see two garbage symbols on the joint of two buffer rendering result. Looks very unpleasant..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2412) Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)

Posted by "Brad Baker (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42963#action_42963 ] 

Brad Baker commented on WW-2412:
--------------------------------

While the patch mentioned does work it is an order of magnitude slower than the current code (albeit with correct character encoding)

A patch contained here http://jira.opensymphony.com/browse/WW-1495 is roughly the same speed as the current code and also has correct unicode encoding.

As yo why its in another project, the history of the code is that webwork 1 became webwork 2 and then struts 2.  This code has been in their for a long time and only affects people when there is > 8K of output in a JSP tag.  hence it has stayed unfixed for  a long time.  Also single byte characters such as Latin 1 are unaffected.

> Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)
> ---------------------------------------------------------------------------------------------
>
>                 Key: WW-2412
>                 URL: https://issues.apache.org/struts/browse/WW-2412
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>         Environment: tomcat 6, windows or linux
>            Reporter: StarBreeze
>
> There is no activity on WW-826 and I cannot reopen it, so I am creting new issue.
> Struts include tag uses the FastByteArrayOutputStream class that copies content of included JSP into the response stream by constant sized char blocks.
> But UTF-8 symbols have different length in bytes. You cannot split a byte stream until you exactly know lengths of it char parts (in bytes). 
> As alternative, you may copy bytes, but DO NOT DO new String(bytes, encoding).
> Seems the second approach is not applicable to the char's http response. 
> There is the good patch already: http://jira.atlassian.com/browse/JRA-13866 
> It solves the problem. 
> The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols in the included JSP (JSP must be included by the struts include tag). Both parent and included JSPs must have contentType="text/html; charset=UTF-8". 
> In this situation you may see two garbage symbols on the joint of two buffer rendering result. Looks very unpleasant..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WW-2412) Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)

Posted by "StarBreeze (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43055#action_43055 ] 

StarBreeze commented on WW-2412:
--------------------------------

The issue is fixed in Webwork already:
http://jira.atlassian.com/browse/JRA-13866?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

> Include tag may produce broken characters (as result of the bug in FastByteArrayOutputStream)
> ---------------------------------------------------------------------------------------------
>
>                 Key: WW-2412
>                 URL: https://issues.apache.org/struts/browse/WW-2412
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.0.11
>         Environment: tomcat 6, windows or linux
>            Reporter: StarBreeze
>             Fix For: 2.1.1
>
>
> There is no activity on WW-826 and I cannot reopen it, so I am creting new issue.
> Struts include tag uses the FastByteArrayOutputStream class that copies content of included JSP into the response stream by constant sized char blocks.
> But UTF-8 symbols have different length in bytes. You cannot split a byte stream until you exactly know lengths of it char parts (in bytes). 
> As alternative, you may copy bytes, but DO NOT DO new String(bytes, encoding).
> Seems the second approach is not applicable to the char's http response. 
> There is the good patch already: http://jira.atlassian.com/browse/JRA-13866 
> It solves the problem. 
> The bug can be reproduced by rendering a large (>8KB) block of non ANSI symbols in the included JSP (JSP must be included by the struts include tag). Both parent and included JSPs must have contentType="text/html; charset=UTF-8". 
> In this situation you may see two garbage symbols on the joint of two buffer rendering result. Looks very unpleasant..

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.