mirror of
https://github.com/upx/upx.git
synced 2024-12-04 02:42:20 +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[]
|
// Rust and Android trim unused zeroes from high end of hasharr[]
|
||||||
unsigned bmax = 0;
|
unsigned bmax = 0;
|
||||||
for (unsigned j= 0; j < n_bucket; ++j) {
|
for (unsigned j= 0; j < n_bucket; ++j) {
|
||||||
if (buckets[j]) {
|
unsigned bj = get_te32(&buckets[j]);
|
||||||
if (buckets[j] < symbias) {
|
if (bj) {
|
||||||
|
if (bj < symbias) {
|
||||||
char msg[50]; snprintf(msg, sizeof(msg),
|
char msg[50]; snprintf(msg, sizeof(msg),
|
||||||
"bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n",
|
"bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n",
|
||||||
buckets[j], symbias);
|
bj, symbias);
|
||||||
throwCantPack(msg);
|
throwCantPack(msg);
|
||||||
}
|
}
|
||||||
if (bmax < buckets[j]) {
|
if (bmax < bj) {
|
||||||
bmax = buckets[j];
|
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[]
|
// Rust and Android trim unused zeroes from high end of hasharr[]
|
||||||
unsigned bmax = 0;
|
unsigned bmax = 0;
|
||||||
for (unsigned j= 0; j < n_bucket; ++j) {
|
for (unsigned j= 0; j < n_bucket; ++j) {
|
||||||
if (buckets[j]) {
|
unsigned bj = get_te32(&buckets[j]);
|
||||||
if (buckets[j] < symbias) {
|
if (bj) {
|
||||||
|
if (bj < symbias) {
|
||||||
char msg[50]; snprintf(msg, sizeof(msg),
|
char msg[50]; snprintf(msg, sizeof(msg),
|
||||||
"bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n",
|
"bad DT_GNU_HASH bucket[%d] < symbias{%#x}\n",
|
||||||
buckets[j], symbias);
|
bj, symbias);
|
||||||
throwCantPack(msg);
|
throwCantPack(msg);
|
||||||
}
|
}
|
||||||
if (bmax < buckets[j]) {
|
if (bmax < bj) {
|
||||||
bmax = buckets[j];
|
bmax = bj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user