Skip to content

Commit

Permalink
Compatibility with python2.4 was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
LRGH committed Mar 10, 2024
1 parent 94f63f9 commit 653ed06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/portability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,14 @@ jobs:
cd Python-2.4.6
./configure
make
export PATH=$(pwd):$PATH
cd ../cpu_rec
sudo ln -fs $(pwd)/python /usr/local/bin/python
- name: Test python version
run: |
python -c 'import sys;print(sys.version)'
python -V
- name: Uncompress corpus (no lzma module in python2.4)
run: |
unxz cpu_rec_corpus/*.xz
- name: Analyze /bin/sh
run: |
python ./cpu_rec.py -v /bin/sh
Expand Down
7 changes: 5 additions & 2 deletions cpu_rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,11 @@ def extract_section_lief(data, section=None):
l = lief.parse(data)
if not l:
return data
res = b""
section_names = [section] if section else [".text", "__TEXT"]
res = struct.pack("")
if section:
section_names = [section]
else:
section_names = [".text", "__TEXT"]
for s in l.sections:
if s.name in section_names:
res += s.content
Expand Down

0 comments on commit 653ed06

Please sign in to comment.