@@ -1131,8 +1131,8 @@ void ObjFile<ELFT>::initializeSymbols(const object::ELFFile<ELFT> &obj) {
11311131 sym->isUsedInRegularObj = true ;
11321132 if (LLVM_UNLIKELY (eSym.st_shndx == SHN_COMMON)) {
11331133 if (value == 0 || value >= UINT32_MAX)
1134- Fatal (ctx) << this << " : common symbol '" << sym->getName ()
1135- << " ' has invalid alignment: " << value;
1134+ Err (ctx) << this << " : common symbol '" << sym->getName ()
1135+ << " ' has invalid alignment: " << value;
11361136 hasCommonSyms = true ;
11371137 sym->resolve (ctx, CommonSymbol{ctx, this , StringRef (), binding, stOther,
11381138 type, value, size});
@@ -1384,16 +1384,22 @@ std::vector<uint32_t> SharedFile::parseVerneed(const ELFFile<ELFT> &obj,
13841384 ArrayRef<uint8_t > data = CHECK2 (obj.getSectionContents (*sec), this );
13851385 const uint8_t *verneedBuf = data.begin ();
13861386 for (unsigned i = 0 ; i != sec->sh_info ; ++i) {
1387- if (verneedBuf + sizeof (typename ELFT::Verneed) > data.end ())
1388- Fatal (ctx) << this << " has an invalid Verneed" ;
1387+ if (verneedBuf + sizeof (typename ELFT::Verneed) > data.end ()) {
1388+ Err (ctx) << this << " has an invalid Verneed" ;
1389+ break ;
1390+ }
13891391 auto *vn = reinterpret_cast <const typename ELFT::Verneed *>(verneedBuf);
13901392 const uint8_t *vernauxBuf = verneedBuf + vn->vn_aux ;
13911393 for (unsigned j = 0 ; j != vn->vn_cnt ; ++j) {
1392- if (vernauxBuf + sizeof (typename ELFT::Vernaux) > data.end ())
1393- Fatal (ctx) << this << " has an invalid Vernaux" ;
1394+ if (vernauxBuf + sizeof (typename ELFT::Vernaux) > data.end ()) {
1395+ Err (ctx) << this << " has an invalid Vernaux" ;
1396+ break ;
1397+ }
13941398 auto *aux = reinterpret_cast <const typename ELFT::Vernaux *>(vernauxBuf);
1395- if (aux->vna_name >= this ->stringTable .size ())
1396- Fatal (ctx) << this << " has a Vernaux with an invalid vna_name" ;
1399+ if (aux->vna_name >= this ->stringTable .size ()) {
1400+ Err (ctx) << this << " has a Vernaux with an invalid vna_name" ;
1401+ break ;
1402+ }
13971403 uint16_t version = aux->vna_other & VERSYM_VERSION;
13981404 if (version >= verneeds.size ())
13991405 verneeds.resize (version + 1 );
@@ -1481,13 +1487,17 @@ template <class ELFT> void SharedFile::parse() {
14811487 for (const Elf_Dyn &dyn : dynamicTags) {
14821488 if (dyn.d_tag == DT_NEEDED) {
14831489 uint64_t val = dyn.getVal ();
1484- if (val >= this ->stringTable .size ())
1485- Fatal (ctx) << this << " : invalid DT_NEEDED entry" ;
1490+ if (val >= this ->stringTable .size ()) {
1491+ Err (ctx) << this << " : invalid DT_NEEDED entry" ;
1492+ return ;
1493+ }
14861494 dtNeeded.push_back (this ->stringTable .data () + val);
14871495 } else if (dyn.d_tag == DT_SONAME) {
14881496 uint64_t val = dyn.getVal ();
1489- if (val >= this ->stringTable .size ())
1490- Fatal (ctx) << this << " : invalid DT_SONAME entry" ;
1497+ if (val >= this ->stringTable .size ()) {
1498+ Err (ctx) << this << " : invalid DT_SONAME entry" ;
1499+ return ;
1500+ }
14911501 soName = this ->stringTable .data () + val;
14921502 }
14931503 }
0 commit comments