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 ax...@ws.apache.org on 2004/10/05 12:09:31 UTC
[jira] Created: (AXISCPP-186) The WSDL2WS generated class constructors needs to 'zero' all parameters
Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/AXISCPP-186
Here is an overview of the issue:
---------------------------------------------------------------------
Key: AXISCPP-186
Summary: The WSDL2WS generated class constructors needs to 'zero' all parameters
Type: Bug
Status: Open
Priority: Major
Project: Axis-C++
Components:
WSDL generation
Assignee: Fred Preston
Reporter: Fred Preston
Created: Tue, 5 Oct 2004 3:08 AM
Updated: Tue, 5 Oct 2004 3:08 AM
Environment: n/a
Description:
Summary:
========
The WSDL2WS generated class constructors needs to 'zero' all parameters.
Problem:
========
Currently, the constructor only nulls the class variables that are pointers, i.e.
object.h
--------
ObjectBean* Bean;
ObjectBeanArrayType* BeanArray;
xsd__boolean Boolean;
xsd__base64Binary ByteArray;
object.c
--------
Object::Object()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
Bean=0;
BeanArray=0;
}
If the user does not properly setup the object before serialisation (i.e ByteArray), problems can occur when the serialiser tries to serialise a bad pointer.
Solution:
=========
By adding additional code to the WSDL2WS code, the constructor can null non-pointer variables as follows:-
object.c
--------
Object::Object()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
Bean=0;
BeanArray=0;
memset( &Boolean, 0, sizeof( xsd__boolean));
memset( &ByteArray, 0, sizeof( xsd__base64Binary));
}
Thus if the user tries to serialise an object without properly initialising it first, there will not be any invalid pointers within the object.
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
[jira] Closed: (AXISCPP-186) The WSDL2WS generated class constructors needs to 'zero' all parameters
Posted by ax...@ws.apache.org.
Message:
The following issue has been closed.
Resolver: Fred Preston
Date: Tue, 5 Oct 2004 5:01 AM
Hi All,
Changed code in org.apache.axis.wsdl.wsdl2ws.cpp.literal.BeanParamWriter from
protected void writeConstructors() throws WrapperFault {
try{
writer.write("\n"+classname+"::"+classname+"()\n{\n");
writer.write("\t/*do not allocate memory to any pointer members here\n\t because deserializer will allocate memory anyway. */\n");
for(int i = 0; i< attribs.length;i++){
if (attribs[i].isArray()){
writer.write("\t"+attribs[i].getParamName()+".m_Array = 0;\n");
writer.write("\t"+attribs[i].getParamName()+".m_Size = 0;\n");
}
else if (!attribs[i].isSimpleType()){
writer.write("\t"+attribs[i].getParamName()+"=0;\n");
} else {
/* Needed for shared libraries */
if ("xsd__string".equals(attribs[i].getTypeName()))
writer.write("\t"+attribs[i].getParamName()+" = 0;\n");
}
}
To:
protected void writeConstructors() throws WrapperFault {
try{
writer.write("\n"+classname+"::"+classname+"()\n{\n");
writer.write("\t/*do not allocate memory to any pointer members here\n\t because deserializer will allocate memory anyway. */\n");
for(int i = 0; i< attribs.length;i++){
if (attribs[i].isArray()){
writer.write("\t"+attribs[i].getParamName()+".m_Array = 0;\n");
writer.write("\t"+attribs[i].getParamName()+".m_Size = 0;\n");
}
else if (!attribs[i].isSimpleType()){
writer.write("\t"+attribs[i].getParamName()+"=0;\n");
} else {
/* Needed for shared libraries */
writer.write("\tmemset( &" + attribs[i].getParamName() + ", 0, sizeof( " + attribs[i].getTypeName() + "));\n");
}
}
The new code clears the variable.
---------------------------------------------------------------------
View the issue:
http://issues.apache.org/jira/browse/AXISCPP-186
Here is an overview of the issue:
---------------------------------------------------------------------
Key: AXISCPP-186
Summary: The WSDL2WS generated class constructors needs to 'zero' all parameters
Type: Bug
Status: Closed
Priority: Major
Resolution: FIXED
Project: Axis-C++
Components:
WSDL generation
Assignee: Fred Preston
Reporter: Fred Preston
Created: Tue, 5 Oct 2004 3:08 AM
Updated: Tue, 5 Oct 2004 5:01 AM
Environment: n/a
Description:
Summary:
========
The WSDL2WS generated class constructors needs to 'zero' all parameters.
Problem:
========
Currently, the constructor only nulls the class variables that are pointers, i.e.
object.h
--------
ObjectBean* Bean;
ObjectBeanArrayType* BeanArray;
xsd__boolean Boolean;
xsd__base64Binary ByteArray;
object.c
--------
Object::Object()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
Bean=0;
BeanArray=0;
}
If the user does not properly setup the object before serialisation (i.e ByteArray), problems can occur when the serialiser tries to serialise a bad pointer.
Solution:
=========
By adding additional code to the WSDL2WS code, the constructor can null non-pointer variables as follows:-
object.c
--------
Object::Object()
{
/*do not allocate memory to any pointer members here
because deserializer will allocate memory anyway. */
Bean=0;
BeanArray=0;
memset( &Boolean, 0, sizeof( xsd__boolean));
memset( &ByteArray, 0, sizeof( xsd__base64Binary));
}
Thus if the user tries to serialise an object without properly initialising it first, there will not be any invalid pointers within the object.
---------------------------------------------------------------------
JIRA INFORMATION:
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
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira