Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
smol
Commits
1e553444
Commit
1e553444
authored
Mar 06, 2019
by
PoroCYon
Committed by
PoroCYon
Mar 06, 2019
Browse files
fix crash when a hash's LSbyte is 0
parent
237ba991
Changes
2
Show whitespace changes
Inline
Side-by-side
smoldd.py
View file @
1e553444
...
@@ -121,11 +121,12 @@ def main():
...
@@ -121,11 +121,12 @@ def main():
# if the next libname/first byte of the hash is null, the table has
# if the next libname/first byte of the hash is null, the table has
# come to an end.
# come to an end.
if
is32bit
:
j
=
poff
j
=
poff
strtaboff
=
0
strtaboff
=
0
while
j
<
poff
+
pfsz
:
while
j
<
poff
+
pfsz
:
tag
,
j
=
(
readint
(
blob
,
j
)
if
is32bit
else
readlong
(
blob
,
j
))
tag
,
j
=
readint
(
blob
,
j
)
ptr
,
j
=
(
readint
(
blob
,
j
)
if
is32bit
else
readlong
(
blob
,
j
))
ptr
,
j
=
readint
(
blob
,
j
)
if
tag
==
5
:
# DT_STRTAB
if
tag
==
5
:
# DT_STRTAB
strtaboff
=
ptr
strtaboff
=
ptr
...
@@ -141,12 +142,12 @@ def main():
...
@@ -141,12 +142,12 @@ def main():
sys
.
stdout
.
write
(
"* "
+
libname
)
sys
.
stdout
.
write
(
"* "
+
libname
)
libs
=
list
(
find_libs
(
(
32
if
is32bit
else
64
)
,
deflibs
,
libname
))
libs
=
list
(
find_libs
(
32
,
deflibs
,
libname
))
print
(
" -> NOT FOUND"
if
len
(
libs
)
==
0
else
(
" -> "
+
libs
[
0
]))
print
(
" -> NOT FOUND"
if
len
(
libs
)
==
0
else
(
" -> "
+
libs
[
0
]))
ht
=
dict
({})
if
len
(
libs
)
==
0
else
build_hashtab
(
args
.
scanelf
,
libs
[
0
])
ht
=
dict
({})
if
len
(
libs
)
==
0
else
build_hashtab
(
args
.
scanelf
,
libs
[
0
])
while
True
:
while
True
:
hashv
,
j
=
(
readint
(
blob
,
j
)
if
is32bit
else
readlong
(
blob
,
j
))
hashv
,
j
=
readint
(
blob
,
j
)
if
(
hashv
&
0xFF
)
==
0
:
if
(
hashv
&
0xFF
)
==
0
:
break
break
...
@@ -157,6 +158,9 @@ def main():
...
@@ -157,6 +158,9 @@ def main():
j
=
bakoff
j
=
bakoff
break
break
else
:
# 64-bit
eprintf
(
"Currently unsuppored, sorry."
)
sys
.
exit
(
1
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
main
()
main
()
...
...
src/loader64.asm
View file @
1e553444
...
@@ -129,7 +129,7 @@ repne scasd ; technically, scasq should be used, but ehhhh
...
@@ -129,7 +129,7 @@ repne scasd ; technically, scasq should be used, but ehhhh
; *phash = finaladdr
; *phash = finaladdr
stosq
stosq
cmp
byte
[
rdi
],
0
cmp
word
[
rdi
],
0
jne
short
.next_hash
jne
short
.next_hash
; } while (1)
; } while (1)
; jmp short .next_hash
; jmp short .next_hash
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment