Overview
Artifact ID: | 0831051fa39abd8a103ff1ec9d4904e6703000fe9a24f8bd3ac3e5723e76ccbd |
---|---|
Ticket: | e59985dfdfbecfb1238b91f1094fe31344e4fa8f
type_name:job allocates on the stack |
User & Date: | luismachuca 2019-02-26 13:42:25 |
Changes
- foundin changed to: "<91"
- icomment:
<tt>library/type_name.hpp</tt> line 30: the header provides typeid demangle, however for compilers using <tt>cxxabi</tt> (eg.: GCC), it calls <tt>abi::__cxa_demangle</tt> with a buffer allocated on the stack. <verbatim> char buf[1024]; // <-- error is this size_t size=sizeof(buf); int status; char* res = abi::__cxa_demangle (name, buf, &size, &status); </verbatim> Relevant quotes from the cxxabi documentation: <blockquote>output_buffer A region of memory, allocated with malloc, of *length bytes, into which the demangled name is stored. </blockquote> <blockquote> The caller is responsible for deallocating this memory using free. </blockquote> Sourced by [1] referencing [2]. * [1] [https://stackoverflow.com/questions/281818/unmangling-the-result-of-stdtype-infoname] * [2] [http://panthema.net/2008/0901-stacktrace-demangled/cxa_demangle.html]
- login: "luismachuca"
- mimetype: "text/x-fossil-wiki"
- severity changed to: "Critical"
- status changed to: "Open"
- title changed to: "type_name:job allocates on the stack"
- type changed to: "Code_Defect"