You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Lahiru Gunathilake (JIRA)" <ji...@apache.org> on 2008/01/04 04:32:34 UTC

[jira] Created: (AXIS2C-867) Function axis2_svc_client_remove_all_headers

Function axis2_svc_client_remove_all_headers
--------------------------------------------

                 Key: AXIS2C-867
                 URL: https://issues.apache.org/jira/browse/AXIS2C-867
             Project: Axis2-C
          Issue Type: Bug
          Components: core/clientapi
    Affects Versions: Current (Nightly)
         Environment: Ubuntu 7.04
            Reporter: Lahiru Gunathilake
             Fix For: Current (Nightly)


 for (i = 0; i < size; i++)
    {
        /*axiom_node_t *node = NULL;                                                                                                                         
           node = axutil_array_list_get(svc_client->headers, env, i);                                                                                        
                                                                                                                                                             
           if (node)                                                                                                                                         
           {                                                                                                                                                 
           axiom_node_free_tree(node, env);                                                                                                                  
           node = NULL;                                                                                                                                      
           } */
        axutil_array_list_remove(svc_client->headers, env, i);
    }
AXIS2_EXTERN void *AXIS2_CALL
 axutil_array_list_remove(
     struct axutil_array_list *array_list,
     const axutil_env_t * env,
     int index)
 {
     void *result = NULL;
     int i = 0;
     AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);

     if (axutil_array_list_check_bound_exclusive(array_list, env, index))
     {
         result = array_list->data[index];
         for (i = index; i < array_list->size - 1; i++)
             array_list->data[i] = array_list->data[i + 1];
        array_list->size--;
     }

     return result;
 } There is a possible bug in "axis2_svc_client_remove_all_headers" function.  The call to "axutil_array_list_remove" is where the problem stems from.  Since the for-loop  is incrementing, and the value of "array_list->size"  is decrementing, eventually line 120 will fail, and some of the headers will not be cleared out.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-867) Function axis2_svc_client_remove_all_headers

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

Lahiru Gunathilake updated AXIS2C-867:
--------------------------------------

    Attachment: diff.txt

The call to axutil_array_list_remove should be decrementing 

> Function axis2_svc_client_remove_all_headers
> --------------------------------------------
>
>                 Key: AXIS2C-867
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-867
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
>
>         Attachments: diff.txt
>
>
>  for (i = 0; i < size; i++)
>     {
>         /*axiom_node_t *node = NULL;                                                                                                                         
>            node = axutil_array_list_get(svc_client->headers, env, i);                                                                                        
>                                                                                                                                                              
>            if (node)                                                                                                                                         
>            {                                                                                                                                                 
>            axiom_node_free_tree(node, env);                                                                                                                  
>            node = NULL;                                                                                                                                      
>            } */
>         axutil_array_list_remove(svc_client->headers, env, i);
>     }
> AXIS2_EXTERN void *AXIS2_CALL
>  axutil_array_list_remove(
>      struct axutil_array_list *array_list,
>      const axutil_env_t * env,
>      int index)
>  {
>      void *result = NULL;
>      int i = 0;
>      AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
>      if (axutil_array_list_check_bound_exclusive(array_list, env, index))
>      {
>          result = array_list->data[index];
>          for (i = index; i < array_list->size - 1; i++)
>              array_list->data[i] = array_list->data[i + 1];
>         array_list->size--;
>      }
>      return result;
>  } There is a possible bug in "axis2_svc_client_remove_all_headers" function.  The call to "axutil_array_list_remove" is where the problem stems from.  Since the for-loop  is incrementing, and the value of "array_list->size"  is decrementing, eventually line 120 will fail, and some of the headers will not be cleared out.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Resolved: (AXIS2C-867) Function axis2_svc_client_remove_all_headers[Alastair FETTES]

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

Dushshantha Chandradasa resolved AXIS2C-867.
--------------------------------------------

    Resolution: Fixed

> Function axis2_svc_client_remove_all_headers[Alastair FETTES]
> -------------------------------------------------------------
>
>                 Key: AXIS2C-867
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-867
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
>
>         Attachments: diff.txt, diff2.txt
>
>
>  for (i = 0; i < size; i++)
>     {
>         /*axiom_node_t *node = NULL;                                                                                                                         
>            node = axutil_array_list_get(svc_client->headers, env, i);                                                                                        
>                                                                                                                                                              
>            if (node)                                                                                                                                         
>            {                                                                                                                                                 
>            axiom_node_free_tree(node, env);                                                                                                                  
>            node = NULL;                                                                                                                                      
>            } */
>         axutil_array_list_remove(svc_client->headers, env, i);
>     }
> AXIS2_EXTERN void *AXIS2_CALL
>  axutil_array_list_remove(
>      struct axutil_array_list *array_list,
>      const axutil_env_t * env,
>      int index)
>  {
>      void *result = NULL;
>      int i = 0;
>      AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
>      if (axutil_array_list_check_bound_exclusive(array_list, env, index))
>      {
>          result = array_list->data[index];
>          for (i = index; i < array_list->size - 1; i++)
>              array_list->data[i] = array_list->data[i + 1];
>         array_list->size--;
>      }
>      return result;
>  } There is a possible bug in "axis2_svc_client_remove_all_headers" function.  The call to "axutil_array_list_remove" is where the problem stems from.  Since the for-loop  is incrementing, and the value of "array_list->size"  is decrementing, eventually line 120 will fail, and some of the headers will not be cleared out.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-867) Function axis2_svc_client_remove_all_headers

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

Senaka Fernando updated AXIS2C-867:
-----------------------------------

    Attachment: diff2.txt

Hi Lahiru,

I went through your patch. The iterator is decrementing and (size-i) is incrementing. You are heading for an index out of bounds. The trivial fix would be changing the loop iteration to,

for (i = size-1; i >-1; i--)

This removes the items from the end and yields minimum amount of copying and is thus the most efficient mechanism. I've attached a patch with this modification (refer diff2.txt)

Regards,
Senaka

> Function axis2_svc_client_remove_all_headers
> --------------------------------------------
>
>                 Key: AXIS2C-867
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-867
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
>
>         Attachments: diff.txt, diff2.txt
>
>
>  for (i = 0; i < size; i++)
>     {
>         /*axiom_node_t *node = NULL;                                                                                                                         
>            node = axutil_array_list_get(svc_client->headers, env, i);                                                                                        
>                                                                                                                                                              
>            if (node)                                                                                                                                         
>            {                                                                                                                                                 
>            axiom_node_free_tree(node, env);                                                                                                                  
>            node = NULL;                                                                                                                                      
>            } */
>         axutil_array_list_remove(svc_client->headers, env, i);
>     }
> AXIS2_EXTERN void *AXIS2_CALL
>  axutil_array_list_remove(
>      struct axutil_array_list *array_list,
>      const axutil_env_t * env,
>      int index)
>  {
>      void *result = NULL;
>      int i = 0;
>      AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
>      if (axutil_array_list_check_bound_exclusive(array_list, env, index))
>      {
>          result = array_list->data[index];
>          for (i = index; i < array_list->size - 1; i++)
>              array_list->data[i] = array_list->data[i + 1];
>         array_list->size--;
>      }
>      return result;
>  } There is a possible bug in "axis2_svc_client_remove_all_headers" function.  The call to "axutil_array_list_remove" is where the problem stems from.  Since the for-loop  is incrementing, and the value of "array_list->size"  is decrementing, eventually line 120 will fail, and some of the headers will not be cleared out.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


[jira] Updated: (AXIS2C-867) Function axis2_svc_client_remove_all_headers[Alastair FETTES]

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

Lahiru Gunathilake updated AXIS2C-867:
--------------------------------------

    Summary: Function axis2_svc_client_remove_all_headers[Alastair FETTES]  (was: Function axis2_svc_client_remove_all_headers)

> Function axis2_svc_client_remove_all_headers[Alastair FETTES]
> -------------------------------------------------------------
>
>                 Key: AXIS2C-867
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-867
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: Current (Nightly)
>         Environment: Ubuntu 7.04
>            Reporter: Lahiru Gunathilake
>             Fix For: Current (Nightly)
>
>         Attachments: diff.txt, diff2.txt
>
>
>  for (i = 0; i < size; i++)
>     {
>         /*axiom_node_t *node = NULL;                                                                                                                         
>            node = axutil_array_list_get(svc_client->headers, env, i);                                                                                        
>                                                                                                                                                              
>            if (node)                                                                                                                                         
>            {                                                                                                                                                 
>            axiom_node_free_tree(node, env);                                                                                                                  
>            node = NULL;                                                                                                                                      
>            } */
>         axutil_array_list_remove(svc_client->headers, env, i);
>     }
> AXIS2_EXTERN void *AXIS2_CALL
>  axutil_array_list_remove(
>      struct axutil_array_list *array_list,
>      const axutil_env_t * env,
>      int index)
>  {
>      void *result = NULL;
>      int i = 0;
>      AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
>      if (axutil_array_list_check_bound_exclusive(array_list, env, index))
>      {
>          result = array_list->data[index];
>          for (i = index; i < array_list->size - 1; i++)
>              array_list->data[i] = array_list->data[i + 1];
>         array_list->size--;
>      }
>      return result;
>  } There is a possible bug in "axis2_svc_client_remove_all_headers" function.  The call to "axutil_array_list_remove" is where the problem stems from.  Since the for-loop  is incrementing, and the value of "array_list->size"  is decrementing, eventually line 120 will fail, and some of the headers will not be cleared out.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org