summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
diff options
context:
space:
mode:
authorThomas Anderson <thomasanderson@google.com>2019-03-06 21:10:08 +0000
committerThomas Anderson <thomasanderson@google.com>2019-03-06 21:10:08 +0000
commit516d07de071114f24ebcd51b629df70d02f1398a (patch)
treeb7444bbb70efd2745afe3001ecb9e9daddd225be /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
parent3161c89a22f97b14c82db589d593e9da8379395f (diff)
downloadbcm5719-llvm-516d07de071114f24ebcd51b629df70d02f1398a.tar.gz
bcm5719-llvm-516d07de071114f24ebcd51b629df70d02f1398a.zip
[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
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud