<html>
    <head>
      <base href="http://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 --- - clang fails to warn about NSPredicate format string mistakes"
   href="http://llvm.org/bugs/show_bug.cgi?id=19200">19200</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang fails to warn about NSPredicate format string mistakes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sean@rogue-research.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Mistakes with format strings are a well-known security issue, and compilers
warn in many cases.

clang fails to warn here however:

-----------------------
#import <Foundation/Foundation.h>

int main (void)
{
  NSPredicate* predicate = [NSPredicate predicateWithFormat:@"foo == %d"];

  return !!predicate;
}
-----------------------

$ clang --version
clang version 3.5.0 (204240)
Target: x86_64-apple-darwin12.5.0
Thread model: posix


$ clang -Weverything -fsyntax-only ~/test.m

<no warnings given>

According to Greg Parker, "The problem is that +predicateWithFormat: accepts
conversions that are not part of NSString's format string syntax. Adding format
string warnings for new format string syntaxes requires compiler changes."

See also <rdar://10699748>.</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>