Remove CHECK around duplicate FLAG lookup.
It causes an asan initialization-order-fiasco in trying to read the
names of other globally constructed data:
==21449==ERROR: AddressSanitizer: initialization-order-fiasco on address 0x7f6f297bc5e8 at pc 0x7f6f26b332a7 bp 0x7ffd479f8cb0 sp 0x7ffd479f8ca8
READ of size 8 at 0x7f6f297bc5e8 thread T0
#0 0x7f6f26b332a6 in name
webrtc/base/flags.h:83:38
#1 0x7f6f26b332a6 in Lookup
webrtc/base/flags.cc:133
#2 0x7f6f26b332a6 in rtc::FlagList::Register(rtc::Flag*)
webrtc/base/flags.cc:260
#3 0x7f6f2529972b in __cxx_global_var_init.1
BUG=
Review-Url: https://codereview.webrtc.org/2110963004
Cr-Commit-Position: refs/heads/master@{#13479}
This commit is contained in:
@ -257,8 +257,10 @@ int FlagList::SetFlagsFromCommandLine(int* argc, const char** argv,
|
||||
|
||||
void FlagList::Register(Flag* flag) {
|
||||
assert(flag != NULL && strlen(flag->name()) > 0);
|
||||
RTC_CHECK(!Lookup(flag->name())) << "flag " << flag->name()
|
||||
<< " declared twice";
|
||||
// NOTE: Don't call Lookup() within Register because it accesses the name_
|
||||
// of other flags in list_, and if the flags are coming from two different
|
||||
// compilation units, the initialization order between them is undefined, and
|
||||
// this will trigger an asan initialization-order-fiasco error.
|
||||
flag->next_ = list_;
|
||||
list_ = flag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user