On 08/12/15 02:00 PM, Jeff Epler wrote:
> I've found two problems.  One is a problem in linuxcnc, which we should
> be able to fix in our stable and development branches.  It is the
> problem you hit first.
>
> A patch for the linuxcnc issue I discovered is at
> https://emergent.unpythonic.net/files/sandbox/0001-interp-don-t-return-potentially-stacked-data.patch
> and inlined below as well.
>
> However, the other will still affect you because it is in the version of
> boost packaged for fedora 23.  You would have to apply the fix to the
> boost package and rebuild it:
> https://github.com/boostorg/python/commit/fe24ab9dd5440562e27422cd38f7de03356bfd16#commitcomment-11804515
> The consequence of this bug is
> *** Error in `rs274': double free or corruption (!prev): 0x0000000001749450 
> ***
> with one stack frame pointing at
> _ZN5boost6python9exec_fileENS0_3strENS0_3api6objectES3_
> (boost::python::exec_file) and linuxcnc (or rs274 in this case) exits
> immediately.
>
> -- 8< --
> The old formulation was always wrong, because it constructed a temporary
> string and returned the value returned by its .c_str() method.
>
> Historically in libstdc++, this second string had the same .c_str() as
> the other one.  However, in the version of libstdc++ on Fedora 23
> (libstdc++-5.1.1-4.fc23.x86_64) this is not the case.
>
> This led to messages such as
>       cant resolve path to '??????'
> as well as valgrind diagnostics and possibly to the diagnostic "'utf8'
> codec can't decode byte".
>
> Signed-off-by: Jeff Epler <[email protected]>
> ---
>   src/emc/rs274ngc/rs274ngc_pre.cc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/emc/rs274ngc/rs274ngc_pre.cc 
> b/src/emc/rs274ngc/rs274ngc_pre.cc
> index 388c382..332471f 100644
> --- a/src/emc/rs274ngc/rs274ngc_pre.cc
> +++ b/src/emc/rs274ngc/rs274ngc_pre.cc
> @@ -2509,7 +2509,7 @@ const char *strstore(const char *s)
>       if (s == NULL)
>           throw invalid_argument("strstore(): NULL argument");
>       pair< set<string>::iterator, bool > pair = stringtable.insert(s);
> -    return string(*pair.first).c_str();
> +    return pair.first->c_str();
>   }
>   
>   context_struct::context_struct()
Beautiful! It worked. I am so happy, too ...

Thanks, Jeff

------------------------------------------------------------------------------
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to