Index: ELF/InputFiles.cpp =================================================================== --- ELF/InputFiles.cpp +++ ELF/InputFiles.cpp @@ -807,12 +807,9 @@ continue; } - // Ignore local symbols. - if (Versym && VersymIndex == VER_NDX_LOCAL) - continue; const Elf_Verdef *Ver = nullptr; - if (VersymIndex != VER_NDX_GLOBAL) { - if (VersymIndex >= Verdefs.size()) { + if (Versym && VersymIndex != VER_NDX_GLOBAL) { + if (VersymIndex >= Verdefs.size() || VersymIndex == VER_NDX_LOCAL) { error("corrupt input file: version definition index " + Twine(VersymIndex) + " for symbol " + Name + " is out of bounds\n>>> defined in " + toString(this)); Index: test/ELF/corrupted-version-reference.s =================================================================== --- test/ELF/corrupted-version-reference.s +++ test/ELF/corrupted-version-reference.s @@ -5,6 +5,9 @@ # CHECK: error: corrupt input file: version definition index 9 for symbol __cxa_finalize is out of bounds # CHECK: >>> defined in {{.+}}/corrupt-version-reference.so +# CHECK: error: corrupt input file: version definition index 0 for symbol _Jv_RegisterClasses is out of bounds +# CHECK-NEXT: >>> defined in {{.*}}/corrupt-version-reference.so + .globl __start __start: dla $a0, __cxa_finalize