[prev in list] [next in list] [prev in thread] [next in thread] 

List:       axis-c-user
Subject:    Re: RE : RE : problem modifying axutil_stream_t in AXIOM_DATA_SOURCE node
From:       "Dushshantha Chandradasa" <dushshantha.chandaradasa () gmail ! com>
Date:       2008-04-17 7:57:19
Message-ID: b4b0ae830804170056i1a73868ld9a888ceac390096 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Hi Carl,

I tried generating code from the axis2 java latest nightly build for
Calculator.wsdl in the <AXIS2C_SVN_HEAD>\test\resources\wsdl folder.  I got
the service and client working  fine.  I used RC2 Windows Binary. If you can
provide a sample wsdl to regenerate your problem, We can test it and see
whether the problem exists. And also please attach your .c file which
implements your business logic.

regards
Dushshantha


On Thu, Apr 17, 2008 at 1:58 AM, Lefrancois, Carl <
Carl.Lefrancois@axa-canada.com> wrote:

> What is the debugger trace?  I am restricted to win32  :*  so if you mean
> some nix thing then I can't.  I will try to get the trace to you tomorrow.
>
> Thanks for your help
>
> Carl
>
> -----Message d'origine-----
> De : Samisa Abeysinghe [mailto:samisa@wso2.com]
> Envoyé : mercredi, avril 16, 2008 14:32
> À : Apache AXIS C User List
> Objet : Re: RE : problem modifying axutil_stream_t in AXIOM_DATA_SOURCE
> node
>
>
> Is it possible to get the debugger trace?
>
> Samisa...
>
> Lefrancois, Carl wrote:
> > Here is my latest trace.  The crash location has changed.  Now it is
> > crashing on the memcpy inside the axutil_stream_write function, which
> > seems like the same error as last time, only trapped earlier.
> >
> > To recap, these are the calls causing the crash:
> >
> > readSize = axutil_stream_read (stream, env, buffer, streamSize);
> > readSize = axutil_stream_write (stream, env, buffer, streamSize);
> >
> >
> > Carl
> >
> >
> >
> >
> > [Wed Apr 16 14:06:04 2008] [debug]
> > c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t
> > *request_uri_based_dispatcher added to the index 0 of the phase
> > Transport [Wed Apr 16 14:06:04 2008] [debug]
> > c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t
> > *addressing_based_dispatcher added to the index 1 of the phase
> > Transport [Wed Apr 16 14:06:04 2008] [debug]
> > c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t
> > *rest_dispatcher added to the index 0 of the phase Dispatch [Wed Apr
> > 16 14:06:04 2008] [debug] c:\ws\axis_svn\src\core\engine\phase.c(121)
> > axis2_handler_t *soap_message_body_based_dispatcher added to the index
> > 1 of the phase Dispatch [Wed Apr 16 14:06:04 2008] [debug]
> c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t
> *soap_action_based_dispatcher added to the index 2 of the phase Dispatch
> [Wed Apr 16 14:06:04 2008] [debug]
> c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t
> *dispatch_post_conditions_evaluator added to the index 0 of the phase
> PostDispatch [Wed Apr 16 14:06:04 2008] [debug]
> c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t *context_handler
> added to the index 1 of the phase PostDispatch [Wed Apr 16 14:06:04 2008]
> [debug] c:\ws\axis_svn\src\core\deployment\conf_builder.c(233) no custom
> dispatching order found continue with default dispatching order [Wed Apr 16
> 14:06:04 2008] [debug] c:\ws\axis_svn\util\src\class_loader.c(141) Object
> loaded successfully [Wed Apr 16 14:06:04 2008] [debug]
> c:\ws\axis_svn\util\src\class_loader.c(141) Object loaded successfully [Wed
> Apr 16 14:06:04 2008] [error] c:\ws\axis_svn\util\src\dir_handler.c(220) No
> files in the path H:\Projets\SOA\Axis2c\axis_svn\build\deploy/modules.
> > [Wed Apr 16 14:06:04 2008] [error]
> c:\ws\axis_svn\util\src\dir_handler.c(220) No files in the path
> H:\Projets\SOA\Axis2c\axis_svn\build\deploy/services.
> > [Wed Apr 16 14:06:04 2008] [debug]
> c:\ws\axis_svn\src\core\phaseresolver\phase_resolver.c(117) Service name is
> : __ANONYMOUS_SERVICE__
> >
> >
> >
> >
> >
> >
> >
> >
> > -----Message d'origine-----
> > De : Samisa Abeysinghe [mailto:samisa@wso2.com]
> > Envoyé : mercredi, avril 16, 2008 12:08
> > À : Apache AXIS C User List
> > Objet : Re: problem modifying axutil_stream_t in AXIOM_DATA_SOURCE node
> >
> >
> > Lefrancois, Carl wrote:
> >
> >> Hi list,
> >>
> >> Please help with some unexpected behaviour.  This morning I started
> >> using the functions axutil_stream_read and axutil_stream_write to
> >> modify the contents of an AXIOM_DATA_SOURCE node in my payload, and I
> >> am getting program crashes.
> >>
> >>
> >
> > Can you send in the traces of the crashes?
> >
> > Samisa...
> >
> >
> >> I am using WSDL2C generated code stubs, and modifying the
> >> axis2_stub_xx.c file to make changes to the payload.  I inserted a
> >> function at the top of the file and call this function just after the
> >> payload is generated on the line:
> >>
> >>      payload = adb_<type>_serialize(_<type>, env, NULL, NULL,
> AXIS2_TRUE,
> >> NULL, NULL);
> >>       modify_stream_contents(payload, env);
> >>
> >> My function navigates the payload node to find the AXIOM_DATA_SOURCE
> >> node.  It then reads the contents into a buffer and does some
> >> modification, then writes the modified data back into the stream.  I'm
> >> including a minimal version of the function below that only reads the
> >> stream and writes it back again without modification.
> >>
> >> The behaviour is strange: if the axutil_stream_write function
> >> specifies a small count, the program doesn't crash.  In my case, I can
> >> specify up to 1665 bytes without a crash.  (the full message size is
> >> 16860)
> >>
> >> Am I doing something bad here? Are these stream functions meant to be
> >> used in another way? The crash appears to be because of a buffer
> >> overflow that mangles the state of other variables in the system.
> >>
> >> (Axis2/C is version 1.3.0)
> >>
> >> Any help is appreciated.
> >>
> >> Carl
> >>
> >>
> >> void modify_stream_contents(axiom_node_t *_node, const axutil_env_t
> >> *env)
> >> {
> >>   axiom_data_source_t *dataSource = NULL;
> >>   axutil_stream_t * stream = NULL;
> >>   axiom_node_t *currentNode = NULL;
> >>   axis2_char_t *buffer = NULL;
> >>   size_t streamSize = 0;
> >>   size_t readSize = 0;
> >>
> >>   // navigate to node that contains stream
> >>   currentNode = _node;
> >>   while (currentNode && (axiom_node_get_node_type(currentNode, env)
> >> !=
> >> AXIOM_ELEMENT))
> >>   {
> >>     currentNode = axiom_node_get_next_sibling(currentNode, env);
> >>   }
> >>   currentNode = axiom_node_get_first_child(currentNode, env);
> >>   if (!currentNode || (axiom_node_get_node_type(currentNode, env) !=
> >> AXIOM_DATA_SOURCE)) return;
> >>
> >>   // get stream
> >>   dataSource = (axiom_data_source_t *)
> >> axiom_node_get_data_element(currentNode, env);
> >>   stream = axiom_data_source_get_stream(dataSource, env);
> >>   if (!stream) return;
> >>
> >>   streamSize = axutil_stream_get_len(stream, env);
> >>   buffer = (char *) AXIS2_MALLOC (env->allocator, sizeof (char) *
> >> (streamSize));
> >>   readSize = axutil_stream_read (stream, env, buffer, streamSize);
> >>   readSize = axutil_stream_write (stream, env, buffer, 1665  ); //
> >> readSize = axutil_stream_write (stream, env, buffer, streamSize  );
> >>   AXIS2_FREE (env->allocator, buffer);
> >> }
> >>   _____
> >>
> >> "Ce message est confidentiel, a l'usage exclusif du destinataire
> >> ci-dessus et son contenu ne represente en aucun cas un engagement de
> >> la part de AXA, sauf en cas de stipulation expresse et par ecrit de la
> >> part de AXA. Toute publication, utilisation ou diffusion, meme
> >> partielle, doit etre autorisee prealablement. Si vous n'etes pas
> >> destinataire de ce message, merci d'en avertir immediatement
> >> l'expediteur."
> >>
> >> "This e-mail message is confidential, for the exclusive use of the
> >> addressee and its contents shall not constitute a commitment by AXA,
> >> except as otherwise specifically provided in writing by AXA. Any
> >> unauthorized disclosure, use or dissemination, either whole or
> >> partial, is prohibited. If you are not the intended recipient of the
> >> message, please notify the sender immediately."
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
> --
> Samisa Abeysinghe
> Director, Engineering; WSO2 Inc.
>
> http://www.wso2.com/ - "The Open Source SOA Company"
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

[Attachment #3 (text/html)]

Hi Carl,<br><br>I tried generating code from the axis2 java latest
nightly build for Calculator.wsdl in the
&lt;AXIS2C_SVN_HEAD&gt;\test\resource<div id="1fht" class="ArwC7c ckChnd">s\wsdl \
folder.&nbsp; I got the service and client working&nbsp; fine.&nbsp; I used RC2 \
Windows Binary. If you can provide a sample wsdl to regenerate your problem, We can \
test it and see whether the problem exists. And also please attach your .c file which \
implements your business logic. <br><br>regards<br>Dushshantha<br></div><br><br><div \
class="gmail_quote">On Thu, Apr 17, 2008 at 1:58 AM, Lefrancois, Carl &lt;<a \
href="mailto:Carl.Lefrancois@axa-canada.com">Carl.Lefrancois@axa-canada.com</a>&gt; \
wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">What is the debugger trace? \
&nbsp;I am restricted to win32 &nbsp;:* &nbsp;so if you mean some nix thing then I \
can&#39;t. &nbsp;I will try to get the trace to you tomorrow.<br>

<br>
Thanks for your help<br>
<br>
Carl<br>
<div class="Ih2E3d"><br>
-----Message d&#39;origine-----<br>
De : Samisa Abeysinghe [mailto:<a \
href="mailto:samisa@wso2.com">samisa@wso2.com</a>]<br> </div>Envoyé : mercredi, \
avril 16, 2008 14:32<br> <div class="Ih2E3d">À : Apache AXIS C User List<br>
</div>Objet : Re: RE : problem modifying axutil_stream_t in AXIOM_DATA_SOURCE \
node<br> <div><div></div><div class="Wj3C7c"><br>
<br>
Is it possible to get the debugger trace?<br>
<br>
Samisa...<br>
<br>
Lefrancois, Carl wrote:<br>
&gt; Here is my latest trace. &nbsp;The crash location has changed. &nbsp;Now it \
is<br> &gt; crashing on the memcpy inside the axutil_stream_write function, which<br>
&gt; seems like the same error as last time, only trapped earlier.<br>
&gt;<br>
&gt; To recap, these are the calls causing the crash:<br>
&gt;<br>
&gt; readSize = axutil_stream_read (stream, env, buffer, streamSize);<br>
&gt; readSize = axutil_stream_write (stream, env, buffer, streamSize);<br>
&gt;<br>
&gt;<br>
&gt; Carl<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; [Wed Apr 16 14:06:04 2008] [debug]<br>
&gt; c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t<br>
&gt; *request_uri_based_dispatcher added to the index 0 of the phase<br>
&gt; Transport [Wed Apr 16 14:06:04 2008] [debug]<br>
&gt; c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t<br>
&gt; *addressing_based_dispatcher added to the index 1 of the phase<br>
&gt; Transport [Wed Apr 16 14:06:04 2008] [debug]<br>
&gt; c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t<br>
&gt; *rest_dispatcher added to the index 0 of the phase Dispatch [Wed Apr<br>
&gt; 16 14:06:04 2008] [debug] c:\ws\axis_svn\src\core\engine\phase.c(121)<br>
&gt; axis2_handler_t *soap_message_body_based_dispatcher added to the index<br>
&gt; 1 of the phase Dispatch [Wed Apr 16 14:06:04 2008] [debug] \
c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t \
*soap_action_based_dispatcher added to the index 2 of the phase Dispatch [Wed Apr 16 \
14:06:04 2008] [debug] c:\ws\axis_svn\src\core\engine\phase.c(121) axis2_handler_t \
*dispatch_post_conditions_evaluator added to the index 0 of the phase PostDispatch \
[Wed Apr 16 14:06:04 2008] [debug] c:\ws\axis_svn\src\core\engine\phase.c(121) \
axis2_handler_t *context_handler added to the index 1 of the phase PostDispatch [Wed \
Apr 16 14:06:04 2008] [debug] c:\ws\axis_svn\src\core\deployment\conf_builder.c(233) \
no custom dispatching order found continue with default dispatching order [Wed Apr 16 \
14:06:04 2008] [debug] c:\ws\axis_svn\util\src\class_loader.c(141) Object loaded \
successfully [Wed Apr 16 14:06:04 2008] [debug] \
c:\ws\axis_svn\util\src\class_loader.c(141) Object loaded successfully [Wed Apr 16 \
14:06:04 2008] [error] c:\ws\axis_svn\util\src\dir_handler.c(220) No files in the \
path H:\Projets\SOA\Axis2c\axis_svn\build\deploy/modules.<br>

&gt; [Wed Apr 16 14:06:04 2008] [error] c:\ws\axis_svn\util\src\dir_handler.c(220) No \
files in the path H:\Projets\SOA\Axis2c\axis_svn\build\deploy/services.<br> &gt; [Wed \
Apr 16 14:06:04 2008] [debug] \
c:\ws\axis_svn\src\core\phaseresolver\phase_resolver.c(117) Service name is : \
__ANONYMOUS_SERVICE__<br> &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; -----Message d&#39;origine-----<br>
&gt; De : Samisa Abeysinghe [mailto:<a \
href="mailto:samisa@wso2.com">samisa@wso2.com</a>]<br> &gt; Envoyé : mercredi, avril \
16, 2008 12:08<br> &gt; À : Apache AXIS C User List<br>
&gt; Objet : Re: problem modifying axutil_stream_t in AXIOM_DATA_SOURCE node<br>
&gt;<br>
&gt;<br>
&gt; Lefrancois, Carl wrote:<br>
&gt;<br>
&gt;&gt; Hi list,<br>
&gt;&gt;<br>
&gt;&gt; Please help with some unexpected behaviour. &nbsp;This morning I started<br>
&gt;&gt; using the functions axutil_stream_read and axutil_stream_write to<br>
&gt;&gt; modify the contents of an AXIOM_DATA_SOURCE node in my payload, and I<br>
&gt;&gt; am getting program crashes.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt; Can you send in the traces of the crashes?<br>
&gt;<br>
&gt; Samisa...<br>
&gt;<br>
&gt;<br>
&gt;&gt; I am using WSDL2C generated code stubs, and modifying the<br>
&gt;&gt; axis2_stub_xx.c file to make changes to the payload. &nbsp;I inserted a<br>
&gt;&gt; function at the top of the file and call this function just after the<br>
&gt;&gt; payload is generated on the line:<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; &nbsp; &nbsp;payload = adb_&lt;type&gt;_serialize(_&lt;type&gt;, env, \
NULL, NULL, AXIS2_TRUE,<br> &gt;&gt; NULL, NULL);<br>
&gt;&gt; &nbsp; &nbsp; &nbsp; modify_stream_contents(payload, env);<br>
&gt;&gt;<br>
&gt;&gt; My function navigates the payload node to find the AXIOM_DATA_SOURCE<br>
&gt;&gt; node. &nbsp;It then reads the contents into a buffer and does some<br>
&gt;&gt; modification, then writes the modified data back into the stream. \
&nbsp;I&#39;m<br> &gt;&gt; including a minimal version of the function below that \
only reads the<br> &gt;&gt; stream and writes it back again without modification.<br>
&gt;&gt;<br>
&gt;&gt; The behaviour is strange: if the axutil_stream_write function<br>
&gt;&gt; specifies a small count, the program doesn&#39;t crash. &nbsp;In my case, I \
can<br> &gt;&gt; specify up to 1665 bytes without a crash. &nbsp;(the full message \
size is<br> &gt;&gt; 16860)<br>
&gt;&gt;<br>
&gt;&gt; Am I doing something bad here? Are these stream functions meant to be<br>
&gt;&gt; used in another way? The crash appears to be because of a buffer<br>
&gt;&gt; overflow that mangles the state of other variables in the system.<br>
&gt;&gt;<br>
&gt;&gt; (Axis2/C is version 1.3.0)<br>
&gt;&gt;<br>
&gt;&gt; Any help is appreciated.<br>
&gt;&gt;<br>
&gt;&gt; Carl<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; void modify_stream_contents(axiom_node_t *_node, const axutil_env_t<br>
&gt;&gt; *env)<br>
&gt;&gt; {<br>
&gt;&gt; &nbsp; axiom_data_source_t *dataSource = NULL;<br>
&gt;&gt; &nbsp; axutil_stream_t * stream = NULL;<br>
&gt;&gt; &nbsp; axiom_node_t *currentNode = NULL;<br>
&gt;&gt; &nbsp; axis2_char_t *buffer = NULL;<br>
&gt;&gt; &nbsp; size_t streamSize = 0;<br>
&gt;&gt; &nbsp; size_t readSize = 0;<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; // navigate to node that contains stream<br>
&gt;&gt; &nbsp; currentNode = _node;<br>
&gt;&gt; &nbsp; while (currentNode &amp;&amp; (axiom_node_get_node_type(currentNode, \
env)<br> &gt;&gt; !=<br>
&gt;&gt; AXIOM_ELEMENT))<br>
&gt;&gt; &nbsp; {<br>
&gt;&gt; &nbsp; &nbsp; currentNode = axiom_node_get_next_sibling(currentNode, \
env);<br> &gt;&gt; &nbsp; }<br>
&gt;&gt; &nbsp; currentNode = axiom_node_get_first_child(currentNode, env);<br>
&gt;&gt; &nbsp; if (!currentNode || (axiom_node_get_node_type(currentNode, env) \
!=<br> &gt;&gt; AXIOM_DATA_SOURCE)) return;<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; // get stream<br>
&gt;&gt; &nbsp; dataSource = (axiom_data_source_t *)<br>
&gt;&gt; axiom_node_get_data_element(currentNode, env);<br>
&gt;&gt; &nbsp; stream = axiom_data_source_get_stream(dataSource, env);<br>
&gt;&gt; &nbsp; if (!stream) return;<br>
&gt;&gt;<br>
&gt;&gt; &nbsp; streamSize = axutil_stream_get_len(stream, env);<br>
&gt;&gt; &nbsp; buffer = (char *) AXIS2_MALLOC (env-&gt;allocator, sizeof (char) \
*<br> &gt;&gt; (streamSize));<br>
&gt;&gt; &nbsp; readSize = axutil_stream_read (stream, env, buffer, streamSize);<br>
&gt;&gt; &nbsp; readSize = axutil_stream_write (stream, env, buffer, 1665 &nbsp;); \
//<br> &gt;&gt; readSize = axutil_stream_write (stream, env, buffer, streamSize \
&nbsp;);<br> &gt;&gt; &nbsp; AXIS2_FREE (env-&gt;allocator, buffer);<br>
&gt;&gt; }<br>
&gt;&gt; &nbsp; _____<br>
&gt;&gt;<br>
&gt;&gt; &quot;Ce message est confidentiel, a l&#39;usage exclusif du \
destinataire<br> &gt;&gt; ci-dessus et son contenu ne represente en aucun cas un \
engagement de<br> &gt;&gt; la part de AXA, sauf en cas de stipulation expresse et par \
ecrit de la<br> &gt;&gt; part de AXA. Toute publication, utilisation ou diffusion, \
meme<br> &gt;&gt; partielle, doit etre autorisee prealablement. Si vous n&#39;etes \
pas<br> &gt;&gt; destinataire de ce message, merci d&#39;en avertir immediatement<br>
&gt;&gt; l&#39;expediteur.&quot;<br>
&gt;&gt;<br>
&gt;&gt; &quot;This e-mail message is confidential, for the exclusive use of the<br>
&gt;&gt; addressee and its contents shall not constitute a commitment by AXA,<br>
&gt;&gt; except as otherwise specifically provided in writing by AXA. Any<br>
&gt;&gt; unauthorized disclosure, use or dissemination, either whole or<br>
&gt;&gt; partial, is prohibited. If you are not the intended recipient of the<br>
&gt;&gt; message, please notify the sender immediately.&quot;<br>
&gt;&gt;<br>
&gt;&gt; ---------------------------------------------------------------------<br>
&gt;&gt; To unsubscribe, e-mail: <a \
href="mailto:axis-c-user-unsubscribe@ws.apache.org">axis-c-user-unsubscribe@ws.apache.org</a><br>
 &gt;&gt; For additional commands, e-mail: <a \
href="mailto:axis-c-user-help@ws.apache.org">axis-c-user-help@ws.apache.org</a><br> \
&gt;&gt;<br> &gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
--<br>
Samisa Abeysinghe<br>
Director, Engineering; WSO2 Inc.<br>
<br>
<a href="http://www.wso2.com/" target="_blank">http://www.wso2.com/</a> - &quot;The \
Open Source SOA Company&quot;<br> <br>
<br>
---------------------------------------------------------------------<br>
To unsubscribe, e-mail: <a \
href="mailto:axis-c-user-unsubscribe@ws.apache.org">axis-c-user-unsubscribe@ws.apache.org</a><br>
 For additional commands, e-mail: <a \
href="mailto:axis-c-user-help@ws.apache.org">axis-c-user-help@ws.apache.org</a><br> \
<br> <br>
---------------------------------------------------------------------<br>
To unsubscribe, e-mail: <a \
href="mailto:axis-c-user-unsubscribe@ws.apache.org">axis-c-user-unsubscribe@ws.apache.org</a><br>
 For additional commands, e-mail: <a \
href="mailto:axis-c-user-help@ws.apache.org">axis-c-user-help@ws.apache.org</a><br> \
<br> </div></div></blockquote></div><br>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic