[asan] Fix strncmp and strncasecmp interceptors
authorVitaly Buka <vitalybuka@google.com>
Sat, 12 Nov 2016 04:32:31 +0000 (04:32 +0000)
committerVitaly Buka <vitalybuka@google.com>
Sat, 12 Nov 2016 04:32:31 +0000 (04:32 +0000)
commitc557191b210650b1726d64d67a8b824b4d47cd5f
treee5da85437ef50ea725616e2db140666a63932968
parentc1f8e1f35c2110cb3d58ccced2af996ba4d0a3eb
[asan] Fix strncmp and strncasecmp interceptors

Summary:
In non-strict mode we will check memory access for both strings from beginning
to either:
  1. 0-char
  2. size
  3. different chars

In strict mode we will check from beginning to either:
  1. 0-char
  2. size

Previously in strict mode we always checked up to the 0-char.

Reviewers: kcc, eugenis

Subscribers: llvm-commits, kubabrecka

Differential Revision: https://reviews.llvm.org/D26574

llvm-svn: 286708
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
compiler-rt/test/asan/TestCases/strncmp_strict.c