Program crashes if attribute is of type axutil_qname_t* -------------------------------------------------------
Key: AXIS2C-771 URL: https://issues.apache.org/jira/browse/AXIS2C-771 Project: Axis2-C Issue Type: Bug Components: code generation Affects Versions: Current (Nightly) Environment: Win + UNIX Reporter: Michael Mole Priority: Critical If I have a complex type with an attribute of type axutil_qname_t*, my program crashes when serializing because the generated code is trying to write to unallocated memory. For example, my complex type looks like this: <complexType name="Foo"> <sequence> <element name="content" type="anyType" minOccurs="0"> </element> </sequence> <attribute name="property" use="required" type="QName"> </attribute> </complexType> The generated code in the serialize method looks like this: if(!parent_tag_closed) { sprintf(text_value, "%s:%s", axutil_qname_get_prefix(_Foo->property_property, env), axutil_qname_get_localpart(_Foo->property_property, env)); string_to_stream = (axis2_char_t*) AXIS2_MALLOC (env-> allocator, sizeof (axis2_char_t) * (64 + strlen("property" + strlen(text_value)))); sprintf(string_to_stream, " ns2:property=\"%s\"", text_value); axutil_stream_write(stream, env, string_to_stream, axutil_strlen(string_to_stream)); AXIS2_FREE(env-> allocator, string_to_stream); AXIS2_FREE(env->allocator, text_value); ... This crashes when trying to get the strlen(text_value) when assigning string_to_stream. This is because text_value had never been allocated memory. I found that adding this line above the first sprintf allowed the code to proceed: text_value = (axis2_char_t*) AXIS2_MALLOC ( env-> allocator, sizeof (axis2_char_t) * ( 64 + strlen(axutil_qname_get_prefix(_Foo>property_property, env)) + strlen(axutil_qname_get_localpart(_Foo>property_property, env)) ) ); This should be added in CADBBeanTemplateSource.xsl at approximately line 2475 when the axutil_qname_t attribute code is generated. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]