[cfe-dev] createCXString reads one past end byte

Dmitri Gribenko gribozavr at gmail.com
Tue Jan 22 06:49:29 PST 2013


Hello Argyrios,

On Mon, Jan 21, 2013 at 9:13 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> We could change how CXString works; instead of eagerly malloc'ing in case of a StringRef, have it stored in a "StringRef-kind" form and malloc when clang_getCString is called.

This will add an extra backing storage mode to CXString, let's call
that CXS_UnmanagedWithLength.  In this mode we will store the pointer
in 'data', and length will be stored in the upper bits of
'private_flags'.  But who will own the memory returned by
clang_getCString?  We can not change the original CXString from
CXS_UnmanagedWithLength to CXS_Malloc because CXString is a value
type.  Or did I misunderstand something?

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-dev mailing list