mirror of
https://github.com/upx/upx.git
synced 2024-12-03 18:31:13 +00:00
get_te32() when checking DT_GNU_HASH chains (MIPS .so)
https://github.com/upx/upx/issues/473 modified: p_lx_elf.cpp
This commit is contained in:
parent
98973dd8b9
commit
4be6cfebcd
@ -1733,15 +1733,16 @@ PackLinuxElf32::invert_pt_dynamic(Elf32_Dyn const *dynp, unsigned headway)
|
||||
// Rust and Android trim unused zeroes from high end of hasharr[]
|
||||
unsigned bmax = 0;
|
||||
for (unsigned j= 0; j < n_bucket; ++j) {
|
||||
if (buckets[j]) {
|
||||
if (buckets[j] < symbias) {
|
||||
unsigned bj = get_te32(&buckets[j]);
|
||||
if (bj) {
|
||||
if (bj < symbias) {
|
||||
char msg[50]; snprintf(msg, sizeof(msg),
|
||||
"bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n",
|
||||
buckets[j], symbias);
|
||||
bj, symbias);
|
||||
throwCantPack(msg);
|
||||
}
|
||||
if (bmax < buckets[j]) {
|
||||
bmax = buckets[j];
|
||||
if (bmax < bj) {
|
||||
bmax = bj;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5443,15 +5444,16 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway)
|
||||
// Rust and Android trim unused zeroes from high end of hasharr[]
|
||||
unsigned bmax = 0;
|
||||
for (unsigned j= 0; j < n_bucket; ++j) {
|
||||
if (buckets[j]) {
|
||||
if (buckets[j] < symbias) {
|
||||
unsigned bj = get_te32(&buckets[j]);
|
||||
if (bj) {
|
||||
if (bj < symbias) {
|
||||
char msg[50]; snprintf(msg, sizeof(msg),
|
||||
"bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n",
|
||||
buckets[j], symbias);
|
||||
bj, symbias);
|
||||
throwCantPack(msg);
|
||||
}
|
||||
if (bmax < buckets[j]) {
|
||||
bmax = buckets[j];
|
||||
if (bmax < bj) {
|
||||
bmax = bj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user