<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 9, 2014 at 12:52 PM, Yury Gribov <span dir="ltr"><<a href="mailto:tetra2005@gmail.com" target="_blank">tetra2005@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
================<br>
Comment at: asan/lit_tests/TestCases/printf-2.c:2<br>
@@ +1,3 @@<br>
+// RUN: %clang_asan -O2 %s -o %t<br>
+// RUN: not %t 2>&1 | FileCheck %s<br>
+<br>
----------------<br>
</div><div class="im">Yury Gribov wrote:<br>
> Kostya Serebryany wrote:<br>
> > please make these tests run in 3 modes:<br>
> >   ASAN_OPTIONS=check_printf=0<br>
> >   ASAN_OPTIONS=check_printf=1<br>
> >   ASAN_OPTIONS=""<br>
> ><br>
> > we need to test that the flag affects the behavior and that it's default value is what we expect it to be.<br>
> ><br>
> > (use FileCheck --check-prefix=CHECK-ON and --check-prefix=CHECK-OFF)<br>
> Ok.<br>
</div>BTW how do you suggest the check_printf=0 case? In my understanding we'll have UB with absolutely unpredictable behavior...<br></blockquote><div><br></div><div>That's not that bad. </div><div>If you allocate a heap block using asan's allocator, the behavior of an uncheck-ed out-of-bounds read is quite predictable (not from C++ point of view, but from asan's point of view)</div>
<div>E.g. if you do </div><div>  char *x = new char[4000];</div><div> you may be quite confident that an unchecked access to x[4001] is quite ok</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
<br>
<a href="http://llvm-reviews.chandlerc.com/D2480" target="_blank">http://llvm-reviews.chandlerc.com/D2480</a><br>
</blockquote></div><br></div></div>