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 "Bill Blough (Jira)" <ji...@apache.org> on 2020/04/07 15:59:00 UTC

[jira] [Updated] (AXIS2C-1392) axiom_element_find_namespace() can erroneously return NULL with default namespaces

     [ https://issues.apache.org/jira/browse/AXIS2C-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bill Blough updated AXIS2C-1392:
--------------------------------
    Fix Version/s:     (was: Current (Nightly))
                   1.7.0

> axiom_element_find_namespace() can erroneously return NULL with default namespaces
> ----------------------------------------------------------------------------------
>
>                 Key: AXIS2C-1392
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1392
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: core/clientapi
>    Affects Versions: 1.6.0
>         Environment: $ uname -a
> Linux clearwater 2.6.18-8.el5 #1 SMP Thu Mar 15 19:46:53 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
> $ gcc --version
> gcc (GCC) 4.2.2
> Copyright (C) 2007 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>            Reporter: Russell Tempero
>            Assignee: Korale Gamaralalage Nandika Chandrasiri Jayawardana
>            Priority: Major
>             Fix For: 1.7.0
>
>         Attachments: om_element.c.diff
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> The recursive function axiom_element_find_namespace() can erroneously return NULL when it encounters an element that has a default namespace. The problem is in the following block of code contained within axiom_element_find_namespace():
>             default_ns = axiom_element_get_default_namespace(om_element,
>                                                              env, element_node);
>             if (default_ns)
>             {
>                 axis2_char_t *default_uri = NULL;
>                 default_uri = axiom_namespace_get_uri(default_ns, env);
>                 if (axutil_strcmp(uri, default_uri) == 0)
>                 {
>                     return default_ns;
>                 }
>                 else
>                 {
>                     return NULL;
>                 }
>             }
> I am assuming that this code exists as an optimization to potentially avoid the for-loop a few lines farther down. The original intent appears to be to check if the needed namespace is equal to the default and, if so, return that and avoid the for-loop. However, instead of returning NULL if the default namespace is not equal to the desired namespace, the code should then continue on to the for-loop.
> Please review and test my attached fix (om_element.c.diff) for possible inclusion in the Axis2/C project. Let me know if I have drawn any incorrect conclusions or if something is not clear.
> Thanks,
> Russell



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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