axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fred Preston (JIRA)" <>
Subject [jira] Created: (AXISCPP-833) Deserialisation code for HexBinary and Base64BinaryTypes are incorrect
Date Thu, 22 Sep 2005 11:08:28 GMT
Deserialisation code for HexBinary and Base64BinaryTypes are incorrect

         Key: AXISCPP-833
     Project: Axis-C++
        Type: Bug
  Components: Client - Deserialization  
 Environment: n/a
    Reporter: Fred Preston

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:-
param->HexBinary.__ptr = 0
param->HexBinary.__size = 0
HexBinary.__ptr = 0x6DA830
HexBinary.__size = 2

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:
For more information on JIRA, see:

View raw message