On Tue, Feb 19, 2013 at 1:58 PM, Evgeniy Stepanov
<[email protected]> wrote:
> the code at CXString.cpp:85 does not look good at all. It reads 1 byte
> past the end of the string, which may belong to a different
> allocation, and, after some time, that '\0' may not be there anymore!

I know.  This commit just refactors the code without making any
functionality changes.  Removing this check and copying the string
unconditionally will introduce a performance hit that can be avoided.

I am working on a patch that fixes this, will submit it soon.  It
introduces a new class, StringRefNulTerminated, that is derived from
StringRef, to explicitly mark nul-terminated strings in the type
system.  I would appreciate your comments on this patch.

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 <[email protected]>*/
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to