You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "ryabko (JIRA)" <ji...@apache.org> on 2008/11/18 07:16:37 UTC

[jira] Created: (STR-3169) inifinite loop in wildcard mapping

inifinite loop in wildcard mapping
----------------------------------

                 Key: STR-3169
                 URL: https://issues.apache.org/struts/browse/STR-3169
             Project: Struts 1
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.3.9
            Reporter: ryabko


I have that mapping:

    <action path="/page-*"
                   type="ru.ryabko.actions.ShowPage"
                   parameter="{1}">
               <forward name="success" path="/page.jsp"/>
    </action>

The application hang up in WildcardHelper.match() method if i construct URL like that:
              http://localhost/page-{0}

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


[jira] Commented: (STR-3169) inifinite loop in wildcard mapping

Posted by "ryabko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45060#action_45060 ] 

ryabko commented on STR-3169:
-----------------------------

I'm waiting for a 5 minutes and no exceptions are thrown.
Sorry, I made a mistake identifying the bad method.
I run the application under debugger and found the really bad method.
It is ActionConfigMatcher.convertParam(String val, Map vars). It has an infinite loop at line 262 (struts-1.3.9).

In my case the parameters passed into method are:

    val = "{1}"
    vars = "1->{0}, 0->ad-{0}"

So, there is an infinite loop while replacing all instances of the placeholoder, because the placeholder wildcard looks like exact value.

> inifinite loop in wildcard mapping
> ----------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>             Fix For: Pending Review
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Updated: (STR-3169) Infinite loop in wildcard mapping

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

Paul Benedict updated STR-3169:
-------------------------------

         Priority: Critical  (was: Major)
    Fix Version/s:     (was: Pending Review)
                   1.3.11
         Assignee: Paul Benedict
          Summary: Infinite loop in wildcard mapping  (was: inifinite loop in wildcard mapping)

> Infinite loop in wildcard mapping
> ---------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>            Assignee: Paul Benedict
>            Priority: Critical
>             Fix For: 1.3.11
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Commented: (STR-3169) Infinite loop in wildcard mapping

Posted by "ryabko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45366#action_45366 ] 

ryabko commented on STR-3169:
-----------------------------

Thanks

> Infinite loop in wildcard mapping
> ---------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>            Assignee: Paul Benedict
>            Priority: Critical
>             Fix For: 1.3.11, 1.4.0
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Commented: (STR-3169) Infinite loop in wildcard mapping

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45353#action_45353 ] 

Paul Benedict commented on STR-3169:
------------------------------------

I solved the issue and have unit tests to prevent the regression.

So what to do when this happens? Obviously, the action mapping can never successfully be valid. It is an edge case where a couple of requests are incompatible with the action mapping.

I see two possible outcomes:
1) Do not return the action config and log a warning
2) Throw an IllegalStateException.

I think #1 is most appropriate since the request truly has no way of being processed. It's not a system error like #2 so it should be handled gracefully like any other bad request.

Opinions?

> Infinite loop in wildcard mapping
> ---------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>            Assignee: Paul Benedict
>            Priority: Critical
>             Fix For: 1.3.11, 1.4.0
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Commented: (STR-3169) inifinite loop in wildcard mapping

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45286#action_45286 ] 

Paul Benedict commented on STR-3169:
------------------------------------

Do you have a recommendation on how to fix it?

> inifinite loop in wildcard mapping
> ----------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>             Fix For: Pending Review
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Resolved: (STR-3169) Infinite loop in wildcard mapping

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

Paul Benedict resolved STR-3169.
--------------------------------

    Resolution: Fixed

convertParam() now throws an IllegalStateException when matching is recursive. The caller will catch this and not match anything.

> Infinite loop in wildcard mapping
> ---------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>            Assignee: Paul Benedict
>            Priority: Critical
>             Fix For: 1.3.11, 1.4.0
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Commented: (STR-3169) inifinite loop in wildcard mapping

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45058#action_45058 ] 

Paul Benedict commented on STR-3169:
------------------------------------

You say an infinite loop happens. Does it end with a StackOverflowException or anything? Can you give more details?

> inifinite loop in wildcard mapping
> ----------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Issue Comment Edited: (STR-3169) inifinite loop in wildcard mapping

Posted by "ryabko (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45060#action_45060 ] 

ryabko edited comment on STR-3169 at 12/16/08 10:30 PM:
--------------------------------------------------------

I'm waiting for a 5 minutes and no exceptions are thrown.
Sorry, I made a mistake identifying the bad method.
I run the application under debugger and found the really bad method.
It is ActionConfigMatcher.convertParam(String val, Map vars). It has an infinite loop at line 262 (struts-1.3.9).

In my case the parameters passed into method are:

    val = "{1}"
    vars = "1->{0}, 0->page-{0}"

So, there is an infinite loop while replacing all instances of the placeholoder, because the placeholder wildcard looks like exact value.

      was (Author: ryabko):
    I'm waiting for a 5 minutes and no exceptions are thrown.
Sorry, I made a mistake identifying the bad method.
I run the application under debugger and found the really bad method.
It is ActionConfigMatcher.convertParam(String val, Map vars). It has an infinite loop at line 262 (struts-1.3.9).

In my case the parameters passed into method are:

    val = "{1}"
    vars = "1->{0}, 0->ad-{0}"

So, there is an infinite loop while replacing all instances of the placeholoder, because the placeholder wildcard looks like exact value.
  
> inifinite loop in wildcard mapping
> ----------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>             Fix For: Pending Review
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Updated: (STR-3169) inifinite loop in wildcard mapping

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

Paul Benedict updated STR-3169:
-------------------------------

    Fix Version/s: Pending Review

> inifinite loop in wildcard mapping
> ----------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>             Fix For: Pending Review
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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


[jira] Updated: (STR-3169) Infinite loop in wildcard mapping

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

Paul Benedict updated STR-3169:
-------------------------------

    Fix Version/s: 1.4.0

> Infinite loop in wildcard mapping
> ---------------------------------
>
>                 Key: STR-3169
>                 URL: https://issues.apache.org/struts/browse/STR-3169
>             Project: Struts 1
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: ryabko
>            Assignee: Paul Benedict
>            Priority: Critical
>             Fix For: 1.3.11, 1.4.0
>
>
> I have that mapping:
>     <action path="/page-*"
>                    type="ru.ryabko.actions.ShowPage"
>                    parameter="{1}">
>                <forward name="success" path="/page.jsp"/>
>     </action>
> The application hang up in WildcardHelper.match() method if i construct URL like that:
>               http://localhost/page-{0}

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