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 "Fred Preston (JIRA)" <ax...@ws.apache.org> on 2005/10/27 16:48:55 UTC

[jira] Updated: (AXISCPP-863) In the stub generated code, an 'OUT' parameter may be null. Before trying to copy the contents a test should be done on the size of the object.

     [ http://issues.apache.org/jira/browse/AXISCPP-863?page=all ]

Fred Preston updated AXISCPP-863:
---------------------------------

      Component: Client - Stub
        Summary: In the stub generated code, an 'OUT' parameter may be null.  Before trying to copy the contents a test should be done on the size of the object.  (was: In the stub generated codeAn 'OUT' parameter may be null.  Before trying to copy the contents a test should be done on the size of the object.)
    Description: 
For example:-
Axis_Array arr2 = m_pCall->getCmplxArray((void*) Axis_DeSerialize_Items,
                                                                               (void*) Axis_Create_Items,
                                                                               (void*) Axis_Delete_Items,
                                                                               (void*) Axis_GetSize_Items,
                                                                               "Items",
                                                                               Axis_URI_Items);
*OutValue1 = (Items_Array&) arr2;

Becomes:-
Axis_Array arr2 = m_pCall->getCmplxArray((void*) Axis_DeSerialize_Items,
                                                                               (void*) Axis_Create_Items,
                                                                               (void*) Axis_Delete_Items,
                                                                               (void*) Axis_GetSize_Items,
                                                                               "Items",
                                                                               Axis_URI_Items);
if( arr2.m_Size > 0)
{
    *OutValue1 = (Items_Array&) arr2;
}

Where an if is used to check that there is data to copy before trying to copy a null pointer (NB: It is assumed that the pointer to the output parameter passed to the method has already been set to null by the client application otherwise, on return the client code will not know if OutValue1 contains valid data).

OR, to be completely safe...

if( arr2.m_Size > 0)
{
    *OutValue1 = (Items_Array&) arr2;
}
else
{
    OutValue1->m_Size = 0;
    OutValue1->m_Array = NULL;
}


  was:

    Environment: n/a  (was: )

> In the stub generated code, an 'OUT' parameter may be null.  Before trying to copy the contents a test should be done on the size of the object.
> ------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-863
>          URL: http://issues.apache.org/jira/browse/AXISCPP-863
>      Project: Axis-C++
>         Type: Bug
>   Components: Client - Stub
>  Environment: n/a
>     Reporter: Fred Preston

>
> For example:-
> Axis_Array arr2 = m_pCall->getCmplxArray((void*) Axis_DeSerialize_Items,
>                                                                                (void*) Axis_Create_Items,
>                                                                                (void*) Axis_Delete_Items,
>                                                                                (void*) Axis_GetSize_Items,
>                                                                                "Items",
>                                                                                Axis_URI_Items);
> *OutValue1 = (Items_Array&) arr2;
> Becomes:-
> Axis_Array arr2 = m_pCall->getCmplxArray((void*) Axis_DeSerialize_Items,
>                                                                                (void*) Axis_Create_Items,
>                                                                                (void*) Axis_Delete_Items,
>                                                                                (void*) Axis_GetSize_Items,
>                                                                                "Items",
>                                                                                Axis_URI_Items);
> if( arr2.m_Size > 0)
> {
>     *OutValue1 = (Items_Array&) arr2;
> }
> Where an if is used to check that there is data to copy before trying to copy a null pointer (NB: It is assumed that the pointer to the output parameter passed to the method has already been set to null by the client application otherwise, on return the client code will not know if OutValue1 contains valid data).
> OR, to be completely safe...
> if( arr2.m_Size > 0)
> {
>     *OutValue1 = (Items_Array&) arr2;
> }
> else
> {
>     OutValue1->m_Size = 0;
>     OutValue1->m_Array = NULL;
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira