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/09/22 13:08:28 UTC

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

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


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


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

Posted by "Chinthana Danapala (JIRA)" <ax...@ws.apache.org>.
     [ 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


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

Posted by "Fred Preston (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-833?page=all ]
     
Fred Preston closed AXISCPP-833:
--------------------------------


> 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


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

Posted by "Samisa Abeysinghe (JIRA)" <ax...@ws.apache.org>.
    [ 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


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

Posted by "Fred Preston (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXISCPP-833?page=comments#action_12331994 ] 

Fred Preston commented on AXISCPP-833:
--------------------------------------

Could the fixer of this JIRA either create a new or incorporate into an existing test a test that would create a for this function so that we do not regress?

> 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


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

Posted by "Chinthana Danapala (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXISCPP-833?page=all ]
     
Chinthana Danapala resolved AXISCPP-833:
----------------------------------------

    Resolution: Fixed

I have removed the delete statement in HexBinary and Base64Binary types to overcome the problem.

> 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