<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - False positive "format string is not a string literal", SARD #149064"
   href="https://llvm.org/bugs/show_bug.cgi?id=26644">26644</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positive  "format string is not a string literal", SARD #149064
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>test35965@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>(This is the first bug report discovered by one of the SARD tests that I'm
integrating)

The attached file, downloaded from the page at:
<a href="https://samate.nist.gov/SARD/view_testcase.php?tID=149064">https://samate.nist.gov/SARD/view_testcase.php?tID=149064</a>

...file url: <a href="https://samate.nist.gov/SARD/testcases/000/149/064/fmt5-good.c">https://samate.nist.gov/SARD/testcases/000/149/064/fmt5-good.c</a>

causes a false positive "format string is not a string literal".


The function in question:

void
test(char *fmt, char *str)
{
    printf(fmt, str);    /* FIX */
}

Is called with string literals as fmt:

    if(userstr[0] == '!')
        test("<%s>", userstr);
    else 
        test("[%s]", userstr);


...this may not be visible from a local analysis of `test`, which would cause
the warning.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>