[LLVMbugs] [Bug 3218] New: ternary confuses literal format string detection

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Dec 15 20:57:47 PST 2008


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: unassignedclangbugs at nondot.org
        ReportedBy: giles at ghostscript.com
                CC: llvmbugs at cs.uiuc.edu


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.



More information about the llvm-bugs mailing list