Commit Graph

11 Commits

Author SHA1 Message Date
Evgeniy Stepanov 7f915cf8a5 [sanitizer] Fix handling of %n in scanf interceptor.
%n does not increase the input item count. The new code emits writes to %n
arguments even if it has run out of input items.

llvm-svn: 188069
2013-08-09 12:58:35 +00:00
Evgeniy Stepanov b5ec3a2d55 [sanitizer] More accurate scanf parsing without GNU extensions.
In __isoc99_*scanf we don't have to worry about GNUisms, and can parse
%a accurately.

Patch by Jakub Jelinek.

llvm-svn: 174969
2013-02-12 14:29:34 +00:00
Evgeniy Stepanov 455c72d25e [sanitizer] scanf: don't report stores that did not happen.
Respect REAL(scanf) return value and don't report memory stores that
could potentially happen, but did not.

llvm-svn: 174887
2013-02-11 15:16:48 +00:00
Evgeniy Stepanov 5eb25e8d39 [sanitizer] Remove an extra va_copy.
llvm-svn: 174883
2013-02-11 14:08:12 +00:00
Evgeniy Stepanov 7e0430fe4f [sanitizer] Scanf parser improvements.
Handle %a in cases when it is unambiguous.
Handle %m.

Patch by Jakub Jelinek.

llvm-svn: 174882
2013-02-11 14:04:24 +00:00
Evgeniy Stepanov 87c43537df [sanitizer] Improve scanf interceptor
This a rewrite of the scanf parser. The new implementation is pretty close to
the spec, with a few shortcuts taken here and there. It is conservative, i.e.
it gives up parsing if it does not understand some part of the format string,
or runs into an ambiguous % spec. It does not handle some rarely used parts of
the spec, like %n$ - for now.

I'm also moving parser call to after the original *scanf function completes,
so that we can find out the store size of %s directive by the use of strlen()
on the target buffer.

llvm-svn: 174704
2013-02-08 11:17:20 +00:00
Alexey Samsonov 622a7b2408 [Sanitizer] More fixes to scanf interceptor: stub support for %s, support for %[...] directive
llvm-svn: 173451
2013-01-25 15:26:19 +00:00
Alexey Samsonov 4899fb5cfb [Sanitizer] fix errors in scanf interceptors: add support for %c and fix cases like %5d
llvm-svn: 173440
2013-01-25 11:43:32 +00:00
Evgeniy Stepanov 5e7936f646 [sanitizer] Define va_copy on win32.
llvm-svn: 173025
2013-01-21 11:32:50 +00:00
Evgeniy Stepanov c8cde8d736 [sanitizer] Enable cpplint for .inc files.
llvm-svn: 172825
2013-01-18 15:53:43 +00:00
Evgeniy Stepanov a6c4a387ee [sanitizer] Rename 2 files *.h->*.inc as appropriate.
Also add a missing include.

llvm-svn: 172814
2013-01-18 13:01:18 +00:00