<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - ASAN allocator may return blocks without right red zone"
   href="https://bugs.llvm.org/show_bug.cgi?id=42868">42868</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ASAN allocator may return blocks without right red zone
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>4.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>asan
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vitalybuka@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This regressed at r279572 and still broken on r367246

Usually next page is not mapped and so program may crash on SEGV instead of
nice ASAN report.

clang++ -w test.cc -O1 -fsanitize=address -o  /tmp/test
/tmp/test
test: test.cc:13: int main(): Assertion `__asan_address_is_poisoned(p + s)'
failed.



#include <vector>
#include <cassert>
#include <stdlib.h>

extern "C" int __asan_address_is_poisoned(void const volatile *addr);

int main() {
  std::vector<char*> allocs;
  for (int i = 0; i < 100000; ++i) {
    int s = 128;
    char *p = (char *)malloc(s);
    allocs.push_back(p);
    assert(__asan_address_is_poisoned(p + s));
  }

  assert(!allocs.empty());
  for (auto p : allocs)
    free(p);

}</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>