llvm-capstone/libcxx
Thomas Anderson 516d07de07 [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1
The issue is the following code:

    __cn1->__add(*__ip);
    (*__ip)->__c_ = __cn1;

`__ip` points into the array of iterators for container `__cn2`.  This code adds
the iterator to the array of iterators for `__cn1`, and updates the iterator to
point to the new container.

This code works fine, except when `__cn1` and `__cn2` are the same container.
`__cn1->__add()` might need to grow the array of iterators, and when it does,
`__ip` becomes invalid, so the second line becomes a use-after-free error.

Simply swapping the order of the above two lines is not sufficient, because of
the memmove() below.  The easiest and most performant solution is just to skip
touching any iterators if the containers are the same.

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

llvm-svn: 355550
2019-03-06 21:10:08 +00:00
..
benchmarks [CMake] Use correct visibility for linked libraries in CMake 2019-01-30 23:18:05 +00:00
cmake [compiler-rt] Build custom libcxx with libcxxabi 2019-02-17 12:16:20 +00:00
docs [CMake] Support compiler-rt builtins library in tests 2019-02-05 19:50:47 +00:00
fuzzing
include [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1 2019-03-06 21:10:08 +00:00
lib Fix -fsanitize=vptr badness in <__debug> 2019-03-05 02:10:31 +00:00
src Fix ABI compatibility of <stdexcept> with VCRuntime. 2019-03-06 20:31:57 +00:00
test [libc++] Fix use-after-free when building with _LIBCPP_DEBUG=1 2019-03-06 21:10:08 +00:00
utils [libc++] Only add dylib-related features when using the system's libc++ 2019-03-05 22:42:45 +00:00
www Reinstate libc++ patches now that the lldb formatter has been updated. 2019-03-05 18:40:49 +00:00
.arcconfig
.clang-format
.gitignore
appveyor-reqs-install.cmd
appveyor.yml
CMakeLists.txt [compiler-rt] Build custom libcxx with libcxxabi 2019-02-17 12:16:20 +00:00
CREDITS.TXT
LICENSE.TXT Fix typos throughout the license files that somehow I and my reviewers 2019-01-21 09:52:34 +00:00
NOTES.TXT
TODO.TXT