[llvm-bugs] [Bug 29060] New: alloc/dealloc mismatch caught by ASAN

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 19 10:44:53 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=29060

            Bug ID: 29060
           Summary: alloc/dealloc mismatch caught by ASAN
           Product: libc++
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alex.zavodny at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Created attachment 17006
  --> https://llvm.org/bugs/attachment.cgi?id=17006&action=edit
Test code that reproduces the error.

This simple code produces an alloc-dealloc-mismatch report when run with
address sanitization enabled:

#include <stdexcept>
int main()
{
    try {
    throw std::runtime_error("");
    } catch (std::exception const&) {
    }
}

Command line used for compilation:

clang++ -fsanitize=address --stdlib=libc++ alloc_dealloc_mismatch_repro.cpp


Produces, on execution:

=================================================================
==11344==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new [] vs
operator delete) on 0x60300000efe0
    #0 0x4f2740  (/tmp/repro/a.out+0x4f2740)
    #1 0x7ff6d213cf00  (/usr/lib/x86_64-linux-gnu/libc++.so.1+0xc3f00)
    #2 0x7ff6d20f6a30  (/usr/lib/x86_64-linux-gnu/libc++.so.1+0x7da30)
    #3 0x4f5028  (/tmp/repro/a.out+0x4f5028)
    #4 0x7ff6d118ff44  (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #5 0x419d65  (/tmp/repro/a.out+0x419d65)
0x60300000efe0 is located 0 bytes inside of 25-byte region
[0x60300000efe0,0x60300000eff9)
allocated by thread T0 here:
    #0 0x4f2290  (/tmp/repro/a.out+0x4f2290)
    #1 0x7ff6d213194c  (/usr/lib/x86_64-linux-gnu/libc++.so.1+0xb894c)
    #2 0x7ff6d118ff44  (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
SUMMARY: AddressSanitizer: alloc-dealloc-mismatch (/tmp/repro/a.out+0x4f2740) 
==11344==HINT: if you don't care about these errors you may set
ASAN_OPTIONS=alloc_dealloc_mismatch=0
==11344==ABORTING



This reproduces reliably using clang-3.8, on Ubuntu 14.04.



NOTE: the problem does not reproduce with --stdlib=libstdc++.

NOTE: this appears to be a duplicate of bug ID 17379, which is marked as fixed,
but as mentioned still repros on clang-3.8.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160819/016f8ef9/attachment.html>


More information about the llvm-bugs mailing list