[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54415] The row_as_string( index ).c_str() met
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #54415] The row_as_string( index ).c_str() method of the octave-4 charMatrix class fails for strings longer than 15 bytes |
Date: |
Wed, 1 Aug 2018 05:08:01 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:62.0) Gecko/20100101 Firefox/62.0 |
Follow-up Comment #1, bug #54415 (project octave):
This might be a similar issue to the one discovered in bug #54299.
Recently, gcc seems to have changed the lifetime of temporary strings that are
not assigned to a variable. It looks like the C++ string returned by
"row_as_string" is destroyed immediately after is is created. Thus, the
reference to the C string array returned by "c_str" gets invalid. The memory
at that location is no longer protected from being overwritten. The results of
dereferencing that pointer is undefined.
You might be able to fix your code by explicitly assigning the C++ string
returned by "row_as_string" to a variable for which you can control the
scope.
I think there is nothing that Octave can do to influence that behavior.
Please report back if that fixes the issue.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54415>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54415] The row_as_string( index ).c_str() method of the octave-4 charMatrix class fails for strings longer than 15 bytes,
Markus Mützel <=