[cfe-dev] graphviz problem

Ted Kremenek kremenek at apple.com
Tue Nov 11 18:52:24 PST 2008


 From Expr.h:

/// StringLiteral - This represents a string literal expression, e.g.  
"foo"
/// or L"bar" (wide strings).  The actual string is returned by  
getStrData()
/// is NOT null-terminated, and the length of the string is determined  
by
/// calling getByteLength().  The C type for a string is always a
/// ConstantArrayType.

This means that using strlen(StringLiteral::getStrData()) is not safe;  
it will just march off the end of the literal until it hits the first  
null character that lies on the heap.

On Nov 11, 2008, at 6:02 PM, Zhongxing Xu wrote:

> Did you use the fixed version? My observasion is that sometimes  
> strlen(StringLiteral::getStrData()) is different from  
> StringLiteral::getByteLength().
>
> On Tue, Nov 11, 2008 at 11:47 PM, Nuno Lopes <nunoplopes at sapo.pt>  
> wrote:
> Here it works just fine. But my system's default charset is latin0  
> (similar with latin1).
> Nuno
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081111/14da02e8/attachment.html>


More information about the cfe-dev mailing list