]> granicus.if.org Git - clang/commit
[Driver] Avoid invalidated iterator in insertTargetAndModeArgs
authorSerge Pavlov <sepavloff@gmail.com>
Mon, 19 Mar 2018 16:13:43 +0000 (16:13 +0000)
committerSerge Pavlov <sepavloff@gmail.com>
Mon, 19 Mar 2018 16:13:43 +0000 (16:13 +0000)
commit3bd89a4b0543a84457046c08b80149b1c8d358f5
tree540c5380b7459e003916f19087f1bdbe90cff69b
parent1d55d15d7f23ee41436b23d2b3d179e881f8a883
[Driver] Avoid invalidated iterator in insertTargetAndModeArgs

Doing an .insert() can potentially invalidate iterators by reallocating the
vector's storage. When all the stars align just right, this causes segfaults
or glibc aborts.

Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082.

Patch by Hector Martin!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327863 91177308-0d34-0410-b5e6-96231b3b80d8
tools/driver/driver.cpp