axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samisa Abeysinghe (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-833) Deserialisation code for HexBinary and Base64BinaryTypes are incorrect
Date Mon, 03 Oct 2005 01:48:47 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-833?page=comments#action_12331109 ] 

Samisa Abeysinghe commented on AXISCPP-833:
-------------------------------------------

Yes obviously there is a serious mistake here.
I would go with the first suggestion made by Fred, that is not to delete HexBinary object.
I do not see any rational reason why we should be re-allocate memory as suggested by solution
B by Fred, even though that too solves the probem. 

So lets go with solution A and the generated code should look like:

xsd__hexBinary * HexBinary = NULL;
if ((HexBinary = pIWSDZ->getElementAsHexBinary( "HexBinary",0)) != NULL)
{
    param->HexBinary = *( HexBinary );
} 

> Deserialisation code for HexBinary and Base64BinaryTypes are incorrect
> ----------------------------------------------------------------------
>
>          Key: AXISCPP-833
>          URL: http://issues.apache.org/jira/browse/AXISCPP-833
>      Project: Axis-C++
>         Type: Bug
>   Components: Client - Deserialization
>  Environment: n/a
>     Reporter: Fred Preston
>     Assignee: Chinthana Danapala

>
> The deserialisation code for xsd__hexBinary and xsd__base64Binary created by WSDL2Ws
needs to be modified because the pointer to the object is deleted after the copy.  Here is
the code...
> xsd__hexBinary * HexBinary = NULL;
> if ((HexBinary = pIWSDZ->getElementAsHexBinary( "HexBinary",0)) != NULL)
> {
> param->HexBinary = *( HexBinary );
> delete HexBinary;
> }
> The HexBinary element in the param structure is copied from the HexBinary object returned
by the getElementAsHexBinary method on the deserialiser.  If we look at the contents of param->HexBinary
before and after the 'equals' operator, here is what we get:-
> Before:
> param->HexBinary.__ptr = 0
> param->HexBinary.__size = 0
> HexBinary.__ptr = 0x6DA830
> HexBinary.__size = 2
> After:
> param->HexBinary.__ptr = 0x6DA830
> param->HexBinary.__size = 2
> HexBinary.__ptr = 0x6DA830
> HexBinary.__size = 2
> So the contents of HexBinary has been copied to param->HexBinary.  If we now delete
HexBinary, the pointer 0x6Da830 will also be deleted making the address param->HexBinary.__ptr
points to invalid.
> The solution to this is to either:-
> A) Do not delete the returned HexBinary object.  Or
> B) Create a new pointer of length HexBinary.__size and then to copy the contents of HexBinary.__ptr
into the new object.  Then, copy the pointer of this new object into param->HexBinary element
and then you are free to delete the returned HexBinary object.
> This problem/solution also applies to Base64BinaryType.

-- 
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


Mime
View raw message