http://llvm.org/bugs/show_bug.cgi?id=3218

           Summary: ternary confuses literal format string detection
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: parser
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=2306)
 --> (http://llvm.org/bugs/attachment.cgi?id=2306)
simple test file demonstrating the problem

clang r61068 throws a spurious security warning when a the format string
argument is a ternary expression, even when both subexpressions are string
literals.

./base/spprint.c:121:15: warning: format string is not a string literal
(potentially insecure)
        sprintf(str, (fabs(v) > 1 ? "%1.1f" : "%1.8f"), v);
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Source file is from Ghostscript svn.

May be related to Bug 2965?


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to