@@ -1131,8 +1131,8 @@ void ObjFile<ELFT>::initializeSymbols(const object::ELFFile<ELFT> &obj) {
1131
1131
sym->isUsedInRegularObj = true ;
1132
1132
if (LLVM_UNLIKELY (eSym.st_shndx == SHN_COMMON)) {
1133
1133
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;
1136
1136
hasCommonSyms = true ;
1137
1137
sym->resolve (ctx, CommonSymbol{ctx, this , StringRef (), binding, stOther,
1138
1138
type, value, size});
@@ -1384,16 +1384,22 @@ std::vector<uint32_t> SharedFile::parseVerneed(const ELFFile<ELFT> &obj,
1384
1384
ArrayRef<uint8_t > data = CHECK2 (obj.getSectionContents (*sec), this );
1385
1385
const uint8_t *verneedBuf = data.begin ();
1386
1386
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
+ }
1389
1391
auto *vn = reinterpret_cast <const typename ELFT::Verneed *>(verneedBuf);
1390
1392
const uint8_t *vernauxBuf = verneedBuf + vn->vn_aux ;
1391
1393
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
+ }
1394
1398
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
+ }
1397
1403
uint16_t version = aux->vna_other & VERSYM_VERSION;
1398
1404
if (version >= verneeds.size ())
1399
1405
verneeds.resize (version + 1 );
@@ -1481,13 +1487,17 @@ template <class ELFT> void SharedFile::parse() {
1481
1487
for (const Elf_Dyn &dyn : dynamicTags) {
1482
1488
if (dyn.d_tag == DT_NEEDED) {
1483
1489
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
+ }
1486
1494
dtNeeded.push_back (this ->stringTable .data () + val);
1487
1495
} else if (dyn.d_tag == DT_SONAME) {
1488
1496
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
+ }
1491
1501
soName = this ->stringTable .data () + val;
1492
1502
}
1493
1503
}
0 commit comments