From 4bfadd950fedac9629712ae5584319849896a85d Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Tue, 29 Apr 2014 19:42:27 +0000 Subject: scanf analysis: handle scanlists that start with ^] (PR19559) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207573 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ScanfFormatString.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/Analysis/ScanfFormatString.cpp') diff --git a/lib/Analysis/ScanfFormatString.cpp b/lib/Analysis/ScanfFormatString.cpp index 3ff7f0ad2e..18505e263b 100644 --- a/lib/Analysis/ScanfFormatString.cpp +++ b/lib/Analysis/ScanfFormatString.cpp @@ -50,6 +50,15 @@ static bool ParseScanList(FormatStringHandler &H, } } + // Special case: "]^" are the first characters. + if (I + 1 != E && I[0] == '^' && I[1] == ']') { + I += 2; + if (I == E) { + H.HandleIncompleteScanList(start, I - 1); + return true; + } + } + // Look for a ']' character which denotes the end of the scan list. while (*I != ']') { if (++I == E) { -- cgit v1.2.3