axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Senaka Fernando (JIRA)" <j...@apache.org>
Subject [jira] Updated: (AXIS2C-867) Function axis2_svc_client_remove_all_headers
Date Fri, 04 Jan 2008 04:23:35 GMT

     [ 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


Mime
View raw message