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 "Chinthana Danapala (JIRA)" <ax...@ws.apache.org> on 2005/09/27 07:37:54 UTC

[jira] Assigned: (AXISCPP-833) Deserialisation code for HexBinary and Base64BinaryTypes are incorrect

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

Chinthana Danapala reassigned AXISCPP-833:
------------------------------------------

    Assign To: Chinthana Danapala

> 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