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 "Samisa Abeysinghe (JIRA)" <ax...@ws.apache.org> on 2004/11/25 09:29:22 UTC

[jira] Created: (AXISCPP-284) Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp

Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp
-----------------------------------------------------------------------------------------------

         Key: AXISCPP-284
         URL: http://nagoya.apache.org/jira/browse/AXISCPP-284
     Project: Axis-C++
        Type: Bug
    Versions: 1.3 Final    
 Environment: Windows
    Reporter: Samisa Abeysinghe
 Assigned to: Samisa Abeysinghe 
     Fix For: 1.4 Alpha


On Wed, 24 Nov 2004, Steve Hardy wrote:

> Hey there,
>
> I was looking at why axis doesn't want te run on my win32 platform,
and
> came across the following (bad) problem:
>
> SimpleAxisTransport.cpp, line 244:
>
> return m_strSOAPAction.substr(uiOpStart,
> 		m_strSOAPAction.length () -
> 		uiOpStart).c_str();
>
> This is a *bad thing* because you are returning a pointer with 
c_str()
to
> an unnamed string object (the one returned by substr) which is out of
> context when you return the function. This seems to work in linux, 
(as
> long as the stack isn't clobbered), but in windows this fails in 
debug
> mode for sure, and probably in release mode too (MSVC++ 6.0).
>
> I'd recommend recoding this to returning a string object or having a
> c_str() pointer from the m_strSOAPAction object as this doesn't go 
out
of
> context.
>
> Yours,
>   Steve Hardy

And the same problem on line 230 with m_strServiceURI

fixing these two problems (and using Xerces, expat didn't seem to 
work),
fixes the simpleserver on win32.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.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] Resolved: (AXISCPP-284) Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp

Posted by "Samisa Abeysinghe (JIRA)" <ax...@ws.apache.org>.
     [ http://nagoya.apache.org/jira/browse/AXISCPP-284?page=history ]
     
Samisa Abeysinghe resolved AXISCPP-284:
---------------------------------------

    Resolution: Fixed

Added std::string m_strTransportPropertyURI; and std::string m_strTransportPropertyOperation; to SimpleAxisTransport.h to fix the problem.


> Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp
> -----------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-284
>          URL: http://nagoya.apache.org/jira/browse/AXISCPP-284
>      Project: Axis-C++
>         Type: Bug
>     Versions: 1.3 Final
>  Environment: Windows
>     Reporter: Samisa Abeysinghe
>     Assignee: Samisa Abeysinghe
>      Fix For: 1.4 Alpha

>
> On Wed, 24 Nov 2004, Steve Hardy wrote:
> > Hey there,
> >
> > I was looking at why axis doesn't want te run on my win32 platform,
> and
> > came across the following (bad) problem:
> >
> > SimpleAxisTransport.cpp, line 244:
> >
> > return m_strSOAPAction.substr(uiOpStart,
> > 		m_strSOAPAction.length () -
> > 		uiOpStart).c_str();
> >
> > This is a *bad thing* because you are returning a pointer with 
> c_str()
> to
> > an unnamed string object (the one returned by substr) which is out of
> > context when you return the function. This seems to work in linux, 
> (as
> > long as the stack isn't clobbered), but in windows this fails in 
> debug
> > mode for sure, and probably in release mode too (MSVC++ 6.0).
> >
> > I'd recommend recoding this to returning a string object or having a
> > c_str() pointer from the m_strSOAPAction object as this doesn't go 
> out
> of
> > context.
> >
> > Yours,
> >   Steve Hardy
> And the same problem on line 230 with m_strServiceURI
> fixing these two problems (and using Xerces, expat didn't seem to 
> work),
> fixes the simpleserver on win32.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.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-284) Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp

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


> Problem returning a pointer with c_str() to an unnamed string object in SimpleAxisTransport.cpp
> -----------------------------------------------------------------------------------------------
>
>          Key: AXISCPP-284
>          URL: http://issues.apache.org/jira/browse/AXISCPP-284
>      Project: Axis-C++
>         Type: Bug

>     Versions: 1.3 Final
>  Environment: Windows
>     Reporter: Samisa Abeysinghe
>     Assignee: Samisa Abeysinghe
>      Fix For: 1.4 Alpha

>
> On Wed, 24 Nov 2004, Steve Hardy wrote:
> > Hey there,
> >
> > I was looking at why axis doesn't want te run on my win32 platform,
> and
> > came across the following (bad) problem:
> >
> > SimpleAxisTransport.cpp, line 244:
> >
> > return m_strSOAPAction.substr(uiOpStart,
> > 		m_strSOAPAction.length () -
> > 		uiOpStart).c_str();
> >
> > This is a *bad thing* because you are returning a pointer with 
> c_str()
> to
> > an unnamed string object (the one returned by substr) which is out of
> > context when you return the function. This seems to work in linux, 
> (as
> > long as the stack isn't clobbered), but in windows this fails in 
> debug
> > mode for sure, and probably in release mode too (MSVC++ 6.0).
> >
> > I'd recommend recoding this to returning a string object or having a
> > c_str() pointer from the m_strSOAPAction object as this doesn't go 
> out
> of
> > context.
> >
> > Yours,
> >   Steve Hardy
> And the same problem on line 230 with m_strServiceURI
> fixing these two problems (and using Xerces, expat didn't seem to 
> work),
> fixes the simpleserver on win32.

-- 
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