diff --git a/.gitignore b/.gitignore index 48bd1ae..98e0f4f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1 @@ -/radare2-2.9.0.tar.gz -/radare2-3.0.0.tar.gz -/radare2-3.0.1.tar.gz -/radare2-3.1.0.tar.gz -/radare2-3.2.0.tar.gz -/radare2-3.3.0.tar.gz -/radare2-3.4.1.tar.gz -/radare2-3.6.0.tar.gz -/radare2-3.9.0.tar.gz -/radare2-4.2.1.tar.gz -/radare2-4.4.0.tar.gz -/radare2-4.5.0.tar.gz -/radare2-5.1.0.tar.gz -/radare2-5.1.1.tar.gz -/radare2-5.2.0.tar.gz -/radare2-5.2.1.tar.gz -/radare2-5.3.0.tar.gz -/radare2-5.3.1.tar.gz -/radare2-5.4.0.tar.gz -/radare2-5.4.2.tar.gz -/radare2-5.6.0.tar.gz -/radare2-5.6.2.tar.gz -/radare2-5.6.4.tar.gz +/radare2-*.tar.gz diff --git a/README.md b/README.md index 6e0362e..bce9e92 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,24 @@ # radare2 -radare2: the reverse engineering framework \ No newline at end of file +radare2: the reverse engineering framework + + +## How to update + +### Rawhide +* do changes primarily in the rawhide branch +* request side tag with `fedpkg request-side-tag` +* build updated package with `fedpkg build --target=fZZ-build-side-XXXXX` from the `main` branch +* build cutter-re and other dependent packages with the same command from the `main` branch +* when all builds are done, create a bodhi update with `bodhi updates new --from-tag --notes "mynotes" --user YYYYY fZZ-build-side-XXXXX` + +### Stable +* wherever possible us fast-forward merge from rawhide to stable branches +``` +cd fXX +fedpkg pull && git merge origin/rawhide && fedpkg push && fedpkg build +``` +* create buildroot override with `fedpkg override create` +* possibly update and re-build iaito and other dependent packages with `fedpkg build` from the `fXX` branch +* when all builds are done, create a bodhi update with `bodhi updates new --type enhancement --bugs xxxxxxxx --close-bugs --notes "mynotes" radare2-nvr,iaito-nvr,...` + diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..0dc63a5 --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/bin/sh -xe +branch=${1:-$(git branch --show-current)} +dist=$(echo $branch | cut -d- -f1) +case $dist in +devel) + dist=rawhide + ;; +esac + +fedpkg switch-branch $branch +if [ -f .side-tag-$branch ]; then + echo "Side tag for $branch exists" + read ok +else + fedpkg --release $dist request-side-tag > .side-tag-$branch.txt + head -1 .side-tag-$branch.txt | cut "-d'" -f2 > .side-tag-$branch +fi + +git merge rawhide +git push +fedpkg --release $dist verrel > .ver-$branch +fedpkg --release $dist build --target=$(cat .side-tag-$branch) diff --git a/changelog b/changelog new file mode 100644 index 0000000..e5553cc --- /dev/null +++ b/changelog @@ -0,0 +1,293 @@ +* Mon Aug 12 2024 Michal Ambroz - 5.9.4-1 +- bump to 5.9.4 + +* Fri Jul 19 2024 Fedora Release Engineering - 5.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Wed May 22 2024 Michal Ambroz - 5.9.2-1 +- bump to 5.9.2 + +* Sat Apr 20 2024 Michal Ambroz 5.9.0-1 +- bump to 5.9.0 + +* Fri Jan 26 2024 Fedora Release Engineering - 5.8.8-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Mon Jan 22 2024 Fedora Release Engineering - 5.8.8-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Oct 26 2023 Michal Ambroz 5.8.8-3 +- rebuild F40+ with capstone 5.0.1+ + +* Thu Oct 26 2023 Michal Ambroz 5.8.8-2 +- cherrypick from upstream master patches for known vulnerabilities: +- CVE-2023-4322 - heap-buffer-overflow in the brainfuck dissassembler +- CVE-2023-5686 - heap-buffer-overflow in /radare2/shlr/java/code.c + +* Fri Jul 21 2023 Fedora Release Engineering - 5.8.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Jul 05 2023 Michal Ambroz 5.8.8-1 +- bump to 5.8.8 + +* Tue May 23 2023 Michal Ambroz 5.8.6-1 +- bump to 5.8.6 + +* Sat Mar 25 2023 Michal Ambroz 5.8.5-0.3 +- 5.8.5 rebuild from git, patched for segfault + +* Wed Mar 22 2023 Michal Ambroz 5.8.4-2 +- patch for segfault in sdb_hash + +* Thu Mar 16 2023 Michal Ambroz 5.8.4-1 +- bump to 5.8.4 +- fix CVE-2023-27114 + +* Sun Feb 26 2023 Michal Ambroz 5.8.2-2 +- cherrypick upstream patch for fixing the sdb generation from meson + +* Wed Jan 25 2023 Michal Ambroz 5.8.2-1 +- bump to 5.8.2 +- fix CVE-2023-0302 , CVE-2023-0302 + +* Fri Jan 20 2023 Fedora Release Engineering - 5.7.8-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Aug 02 2022 Michal Ambroz 5.7.8-1 +- bump to 5.7.8 + +* Tue Aug 02 2022 Michal Ambroz 5.7.6-1 +- bump to 5.7.6 +- cherrypicked patch for new libmagic from upstream +- fix CVE-2022-34502 + +* Sat Jul 23 2022 Fedora Release Engineering - 5.6.8-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Apr 21 2022 Henrik Nordstrom - 5.6.8-1 +- bump to 5.6.8 + +* Wed Apr 13 2022 Henrik Nordstrom 5.6.6-2 +- refresh list of bundled libraries and associated cleanup + +* Tue Apr 12 2022 Henrik Nordstrom 5.6.6-2 +- Fixes for CVE-2022-1061 CVE-2022-1207 CVE-2022-1237 CVE-2022-1238 + CVE-2022-1240 CVE-2022-1244 CVE-2022-1283 CVE-2022-1284 CVE-2022-1296 + CVE-2022-1297 + +* Tue Apr 12 2022 Henrik Nordstrom 5.6.6-1 +- bump to 5.6.6 + +* Mon Feb 28 2022 Michal Ambroz 5.6.4-1 +- bump to 5.6.4 + +* Wed Feb 09 2022 Michal Ambroz 5.6.2-1 +- bump to 5.6.2 +- disable multithreading for now to be able to compile with iaito + +* Wed Feb 09 2022 Michal Ambroz 5.6.0-2 +- patch declaration of int i in for cycle to avoid C99 mode on EPEL7 + +* Wed Feb 09 2022 Michal Ambroz 5.6.0-1 +- bump to 5.6.0 +- fix CVE-2022-0419 +- fix CVE-2021-4021 + +* Wed Jan 26 2022 Henrik Nordstrom - 5.5.4-1 +- Update to version 5.5.4 +- should be fixing CVE-2021-4021 + +* Fri Jan 21 2022 Fedora Release Engineering - 5.4.2-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Sep 23 2021 Henrik Nordstrom - 5.4.2-1 +- Update to version 5.4.2 + +* Sat Sep 18 2021 Henrik Nordstrom - 5.4.0-1 +- Update to version 5.4.0 +- Fix CVE-2021-3673 + +* Fri Jul 23 2021 Fedora Release Engineering - 5.3.1-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Fri Jun 11 2021 Michal Ambroz 5.3.1-1 +- bump to 5.3.1 + +* Wed Jun 09 2021 Michal Ambroz 5.3.0-1 +- re-enable build for s390x on EPEL8 (libuv should be available for 8.4) +- bump to 5.3.0 +- remove radare2-5.2.1-meson_rhel8.patch - accepted upstream +- remove radare2-5.2.1-xxhash.patch - accepted upstream +- fix CVE-2021-32494 #2221281, #2221280, #2221282 +- fix CVE-2021-32495 #2221285, #2221286 + +* Sat May 15 2021 Michal Ambroz 5.2.1-3 +- adding the global plugins directory - for example /usr/lib64/radare2/5.2.1 + +* Tue May 11 2021 Michal Ambroz 5.2.1-2 +- patch for older version of meson used on EPEL8 +- use pkgconfig where possible for BR +- use ldconfig_scriptlets only on older platforms +- add ExcludeArch for s390x on EPEL8 + +* Thu Apr 22 2021 Henrik Nordstrom - 5.2.1-1 +- Update to version 5.2.1 + +* Wed Apr 21 2021 Michal Ambroz 5.2.0-3 +- avoid c99 for(int i... + +* Sat Apr 17 2021 Michal Ambroz 5.2.0-2 +- fix epel build + +* Wed Apr 14 2021 Henrik Nordstrom - 5.2.0-1 +- Update to version 5.2.0 + +* Sun Feb 28 2021 Michal Ambroz 5.1.1-2 +- stop removing the r2pm binary from the package + +* Mon Feb 15 2021 Henrik Nordstrom - 5.1.1-1 +- Rebase to upstream version 5.1.1 + +* Wed Jan 27 2021 Fedora Release Engineering - 4.5.0-2.2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Oct 2 2020 Riccardo Schirone - 4.5.0-2.1 +- Rebuilt to make sure version is no lower than F32 + +* Wed Jul 29 2020 Fedora Release Engineering - 4.5.0-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 20 2020 Riccardo Schirone - 4.5.0-1 +- Rebase to upstream version 4.5.0 + +* Fri May 8 2020 Riccardo Schirone - 4.4.0-2 +- Just re-build + +* Mon May 4 2020 Riccardo Schirone - 4.4.0-1 +- Rebase to upstream version 4.4.0 + +* Mon Feb 3 2020 Riccardo Schirone - 4.2.1-1 +- Rebase to upstream version 4.2.1 +- Fix CVE-2019-19647 +- Fix CVE-2019-19590 + +* Thu Jan 30 2020 Fedora Release Engineering - 3.9.0-3.2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Mon Oct 07 2019 Riccardo Schirone - 3.9.0-3.1 +- Fix epel7 build + +* Fri Oct 04 2019 Ivan Mironov - 3.9.0-2.1 +- Add missing BuildRequires: xxhash-devel, openssl-devel +- Add missing Requires for -devel package: file-devel, openssl-devel + +* Mon Sep 30 2019 Riccardo Schirone - 3.9.0-1.1 +- rebase to upstream version 3.9.0 + +* Fri Jul 26 2019 Fedora Release Engineering - 3.6.0-1.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Jun 26 2019 Riccardo Schirone - 3.6.0 +- rebase to upstream version 3.6.0 +* Tue Apr 16 2019 Adam Williamson - 3.4.1-2 +- Rebuild with Meson fix for #1699099 +- Fix versioning + +* Mon Apr 8 2019 Riccardo Schirone - 3.4.1-1 +- rebase to upstream version 3.4.1 +* Tue Feb 19 2019 Riccardo Schirone - 3.3.0-2 +- rebase to upstream version 3.3.0 +* Sat Feb 02 2019 Fedora Release Engineering - 3.2.0-2.1 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jan 10 2019 Riccardo Schirone 3.2.0-2 +- fix version reported by radare2 -V +* Tue Jan 8 2019 Riccardo Schirone 3.2.0-1 +- rebase to upstream version 3.2.0 +- remove patch to disable debugger on s390x and use build option +- move doc files to common package +- fix CVE-2018-20455 CVE-2018-20456 CVE-2018-20457 CVE-2018-20458 CVE-2018-20459 CVE-2018-20460 CVE-2018-20461 +* Fri Nov 23 2018 Riccardo Schirone 3.1.0-1 +- rebase to upstream version 3.1.0 +- remove duplicated /usr/share/radare2 dir in %%files +* Tue Oct 23 2018 Riccardo Schirone 3.0.1-1 +- rebase to upstream version 3.0.1 which includes some minor fixes and fixes + for ppc64 and s390x architectures +* Tue Oct 16 2018 Riccardo Schirone 3.0.0-2 +- fix datadir dir ownership +* Tue Oct 16 2018 Riccardo Schirone 3.0.0-1 +- rebase to upstream version 3.0.0 +- fixes for r_sys_breakpoint on ppc64 and s390x architectures +* Tue Sep 4 2018 Riccardo Schirone 2.9.0-1 +- use system xxhash and openssl +- bump to 2.9.0 release +- use bcond_without to choose between release build or git one +- add gcc as BuildRequires +- do not directly call ldconfig but use RPM macros +- add patch to compile on s390x architecture (disable debugger because there is no support) +- add patch to make tags.r2 file generation reproducible +- make common subpackage do not depend on arch of main package + +* Fri Aug 3 2018 Riccardo Schirone 2.8.0-0.2.20180718git51e2936 +- add grub2 and xxhash Provides +- add some license comments +- move SDB files in -common subpackage + +* Mon Jul 16 2018 Riccardo Schirone 2.8.0-0.1.20180718git51e2936 +- bump to 2.8.0 version and switch to meson + +* Fri Apr 13 2018 Michal Ambroz 2.5.0-1 +- bump to 2.5.0 release + +* Sun Feb 11 2018 Michal Ambroz 2.4.0-1 +- bump to 2.4.0 release + +* Mon Feb 05 2018 Michal Ambroz 2.3.0-1 +- bump to 2.3.0 release +- drop the web-interface for now + +* Tue Nov 14 2017 Michal Ambroz 2.0.1-1 +- bump to 2.0.1 release + +* Fri Aug 04 2017 Michal Ambroz 1.6.0-1 +- bump to 1.6.0 release + +* Thu Jun 08 2017 Michal Ambroz 1.5.0-1 +- bump to 1.5.0 release + +* Sun Apr 23 2017 Michal Ambroz 1.4.0-1 +- bump to 1.4.0 release + +* Sat Mar 18 2017 Michal Ambroz 1.3.0-1 +- bump to 1.3.0 release + +* Sat Feb 18 2017 Michal Ambroz 1.3.0-0.1.gita37af19 +- switch to git version fixing sigseg in radiff2 + +* Wed Feb 08 2017 Michal Ambroz 1.2.1-1 +- bump to 1.2.1 +- removed deprecated post postun calling of /sbin/ldconfig + +* Sat Oct 22 2016 Michal Ambroz 0.10.6-1 +- bump to 0.10.6 + +* Sun Aug 21 2016 Michal Ambroz 0.10.5-1 +- bump to 0.10.5 + +* Mon Aug 01 2016 Michal Ambroz 0.10.4-1 +- bump to 0.10.4 + +* Sun Jun 05 2016 Michal Ambroz 0.10.3-1 +- build for Fedora for release of 0.10.3 + +* Mon Apr 25 2016 Michal Ambroz 0.10.2-1 +- build for Fedora for release of 0.10.2 + +* Thu Jan 21 2016 Michal Ambroz 0.10.0-2 +- build for Fedora for release of 0.10.0 + +* Sat Oct 10 2015 Michal Ambroz 0.10.0-1 +- build for Fedora for alpha of 0.10.0 + +* Sun Nov 09 2014 Pavel Odvody 0.9.8rc3-0 +- initial radare2 package diff --git a/radare2-5.6.0-dec99.patch b/radare2-5.6.0-dec99.patch deleted file mode 100644 index 511b873..0000000 --- a/radare2-5.6.0-dec99.patch +++ /dev/null @@ -1,28 +0,0 @@ -Declaration of variable in the for loop requires at least c99 compatibility mode -This is specific to 5.6.0 and is already fixed in the git -diff -ru radare2-5.6.0/libr/anal/p/anal_loongarch_gnu.c radare2-5.6.0.new/libr/anal/p/anal_loongarch_gnu.c ---- radare2-5.6.0/libr/anal/p/anal_loongarch_gnu.c 2022-02-02 13:29:26.000000000 +0100 -+++ radare2-5.6.0.new/libr/anal/p/anal_loongarch_gnu.c 2022-02-12 00:24:15.787894773 +0100 -@@ -1228,7 +1228,8 @@ - ase->la_opcode_ht[LA_INSN_HASH(it->match)] = it; - } - } -- for (int i=0; ila_opcode_ht[i]){ - ase->la_opcode_ht[i]=it; - } -diff -ru radare2-5.6.0/libr/core/disasm.c radare2-5.6.0.new/libr/core/disasm.c ---- radare2-5.6.0/libr/core/disasm.c 2022-02-02 13:29:26.000000000 +0100 -+++ radare2-5.6.0.new/libr/core/disasm.c 2022-02-12 00:28:26.325298373 +0100 -@@ -5483,7 +5483,8 @@ - if (p) { - core->asmqjmps_size = R_CORE_ASMQJMPS_NUM; - core->asmqjmps = p; -- for (int i = 0; i < R_CORE_ASMQJMPS_NUM; i++) { -+ int i; -+ for (i = 0; i < R_CORE_ASMQJMPS_NUM; i++) { - core->asmqjmps[i] = UT64_MAX; - } - } diff --git a/radare2-5.6.6-use_lz4.patch b/radare2-5.6.6-use_lz4.patch new file mode 100644 index 0000000..282cda8 --- /dev/null +++ b/radare2-5.6.6-use_lz4.patch @@ -0,0 +1,12 @@ +diff -ru radare2-5.6.6-orig/libr/util/zip.c radare2-5.6.6/libr/util/zip.c +--- radare2-5.6.6-orig/libr/util/zip.c 2022-03-22 20:06:43.000000000 +0100 ++++ radare2-5.6.6/libr/util/zip.c 2022-04-13 02:48:30.050632855 +0200 +@@ -2,7 +2,7 @@ + + #include + #include +-#include "../../../shlr/lz4/lz4.h" ++#include + + // set a maximum output buffer of 50MB + #define MAXOUT 50000000 diff --git a/radare2-5.6.6-use_openssl.patch b/radare2-5.6.6-use_openssl.patch new file mode 100644 index 0000000..cacc731 --- /dev/null +++ b/radare2-5.6.6-use_openssl.patch @@ -0,0 +1,11 @@ +--- radare2-5.6.6/libr/socket/meson.build.orig 2022-04-13 02:03:18.003440078 +0200 ++++ radare2-5.6.6/libr/socket/meson.build 2022-04-13 02:03:22.879431434 +0200 +@@ -11,6 +11,8 @@ + ] + + r_util_deps = [utl, r_util_dep, platform_deps] ++r_util_static_deps = [] ++ + if get_option('blob') + r_util_static_deps = [utl, r_util_static_dep, platform_deps] + if use_sys_openssl diff --git a/radare2-5.7.6-ebcdic.patch b/radare2-5.7.6-ebcdic.patch new file mode 100644 index 0000000..d4ff96d --- /dev/null +++ b/radare2-5.7.6-ebcdic.patch @@ -0,0 +1,538 @@ +From ddf483893e92f9edcd3d65f1098231b000bfe28a Mon Sep 17 00:00:00 2001 +From: pancake +Date: Sun, 7 Aug 2022 13:17:58 +0200 +Subject: [PATCH] Test and benchmark --with-sysmagic in the CI ##search + +* Improve output of search.verbose +* Remove conflictive magic signature +--- + .github/workflows/ci.yml | 28 ++++++++ + dist/plugins-cfg/plugins.nocs.cfg | 1 + + libr/core/cmd_magic.c | 42 ++++++----- + libr/include/r_magic.h | 8 +-- + libr/magic/apprentice.c | 3 +- + libr/magic/ascmagic.c | 112 +++++++++++++++--------------- + libr/magic/d/default/archive | 110 +++++++++++++++-------------- + libr/magic/magic.c | 4 +- + 8 files changed, 171 insertions(+), 137 deletions(-) + +diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml +index a640d44a02f7..0767be9d6a52 100644 +--- a/.github/workflows/ci.yml ++++ b/.github/workflows/ci.yml +@@ -47,10 +47,38 @@ jobs: + - name: Linting + run: sys/lint.sh + - name: Building without capstone ++ env: ++ CFLAGS: -O0 + run: | + cp -f dist/plugins-cfg/plugins.nocs.cfg plugins.cfg + ./configure --without-capstone --with-rpath && make -j + sudo make install ++ - name: Running c/m with self-hosted libmagic ++ run: ++ time r2 -a gb -e search.verbose=false -qc/m test/bins/mach0/ls-m1 > /tmp/m.1 2>&1 || true ++ cat /tmp/m.1 ++ - name: Uninstall test ++ run: | ++ sudo make uninstall ++ - name: Building with libmagic ++ env: ++ CFLAGS: -O0 ++ run: | ++ sudo apt install -y libmagic-dev ++ git clean -xdf ; rm -rf shlr/capstone ++ cp -f dist/plugins-cfg/plugins.nocs.cfg plugins.cfg ++ ./configure --with-sysmagic --without-capstone --with-rpath && make -j ++ sudo make install ++ - name: Running c/m with system libmagic ++ run: ++ time r2 -a gb -e search.verbose=false -qc/m test/bins/mach0/ls-m1 > /tmp/m.2 2>&1 || true ++ cat /tmp/m.2 ++ - name: Compare magic times and results ++ run: | ++ echo ===== m.1 ++ cat /tmp/m.1 ++ echo ===== m.2 ++ cat /tmp/m.2 + #- name: Building muon/samu + # run: | + # r2pm -gci muon # installs samurai as dependency +diff --git a/dist/plugins-cfg/plugins.nocs.cfg b/dist/plugins-cfg/plugins.nocs.cfg +index 9a9dee5fc5a9..504cce94782e 100644 +--- a/dist/plugins-cfg/plugins.nocs.cfg ++++ b/dist/plugins-cfg/plugins.nocs.cfg +@@ -62,6 +62,7 @@ asm.x86_as + asm.x86_nz + asm.x86_nasm + bin.any ++bin.s390 + bin.wasm + bin.nro + bin.nso +diff --git a/libr/core/cmd_magic.c b/libr/core/cmd_magic.c +index d1862b64462b..083e90d30329 100644 +--- a/libr/core/cmd_magic.c ++++ b/libr/core/cmd_magic.c +@@ -18,8 +18,8 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + const char *str; + int delta = 0, adelta = 0, ret; + ut64 curoffset = core->offset; +- int maxHits = r_config_get_i (core->config, "search.maxhits"); +- if (maxHits > 0 && *hits >= maxHits) { ++ int max_hits = r_config_get_i (core->config, "search.maxhits"); ++ if (max_hits > 0 && *hits >= max_hits) { + return 0; + } + +@@ -27,8 +27,15 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + ret = 0; + goto seek_exit; + } ++ bool must_report_progress = !pj; ++ if (must_report_progress) { ++ must_report_progress = r_config_get_b (core->config, "search.verbose"); ++ if (must_report_progress) { ++ must_report_progress = r_config_get_b (core->config, "scr.interactive"); ++ } ++ } + if (addr != core->offset) { +- if (addr >= core->offset && (addr+NAH) < (core->offset + core->blocksize)) { ++ if (addr >= core->offset && (addr + NAH) < (core->offset + core->blocksize)) { + delta = addr - core->offset; + } else { + r_core_seek (core, addr, true); +@@ -37,18 +44,21 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + if (core->search->align) { + int mod = addr % core->search->align; + if (mod) { +- eprintf ("Unaligned search at %d\n", mod); ++ R_LOG_WARN ("Unaligned search result at %d", mod); + ret = mod; + goto seek_exit; + } + } +- if (((addr&7)==0) && ((addr&(7<<8))==0)) +- if (!pj) { // update search display ++ if (((addr & 7) == 0) && ((addr & (7 << 8)) == 0)) { ++ if (must_report_progress) { + eprintf ("0x%08" PFMT64x " [%d matches found]\r", addr, *hits); + } ++ } + if (file) { +- if (*file == ' ') file++; +- if (!*file) file = NULL; ++ file = r_str_trim_head_ro (file); ++ if (R_STR_ISEMPTY (file)) { ++ file = NULL; ++ } + } + if (file && ofile && file != ofile) { + if (strcmp (file, ofile)) { +@@ -65,7 +75,7 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + free (ofile); + ofile = strdup (file); + if (!r_magic_load (ck, file)) { +- eprintf ("failed r_magic_load (\"%s\") %s\n", file, r_magic_error (ck)); ++ R_LOG_ERROR ("failed r_magic_load (\"%s\") %s", file, r_magic_error (ck)); + ck = NULL; + ret = -1; + goto seek_exit; +@@ -74,7 +84,7 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + const char *magicpath = r_config_get (core->config, "dir.magic"); + if (!r_magic_load (ck, magicpath)) { + ck = NULL; +- eprintf ("failed r_magic_load (dir.magic) %s\n", r_magic_error (ck)); ++ R_LOG_ERROR ("failed r_magic_load (dir.magic) %s", r_magic_error (ck)); + ret = -1; + goto seek_exit; + } +@@ -82,7 +92,7 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + } + //if (v) r_cons_printf (" %d # pm %s @ 0x%"PFMT64x"\n", depth, r_str_get (file), addr); + if (delta + 2 > core->blocksize) { +- eprintf ("EOB\n"); ++ R_LOG_WARN ("magic result happens between block reads"); + ret = -1; + goto seek_exit; + } +@@ -90,7 +100,7 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + if (str) { + const char *cmdhit; + #if USE_LIB_MAGIC +- if (!v && (!strcmp (str, "data") || strstr(str, "ASCII") || strstr(str, "ISO") || strstr(str, "no line terminator"))) { ++ if (!v && (!strcmp (str, "data") || strstr(str, "ASCII") || strstr (str, "ISO") || strstr (str, "no line terminator"))) { + #else + if (!v && (!strcmp (str, "data"))) { + #endif +@@ -126,7 +136,7 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + } + // TODO: This must be a callback .. move this into RSearch? + if (!pj) { +- r_cons_printf ("0x%08"PFMT64x" %d %s\n", addr + adelta, magicdepth-depth, p); ++ r_cons_printf ("0x%08"PFMT64x" %d %s\n", addr + adelta, magicdepth - depth, p); + } else { + pj_o (pj); + pj_kN (pj, "offset", addr + adelta); +@@ -134,7 +144,9 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + pj_ks (pj, "info", p); + pj_end (pj); + } +- r_cons_clear_line (1); ++ if (must_report_progress) { ++ r_cons_clear_line (1); ++ } + //eprintf ("0x%08"PFMT64x" 0x%08"PFMT64x" %d %s\n", addr+adelta, addr+adelta, magicdepth-depth, p); + // walking children + for (q = p; *q; q++) { +@@ -171,13 +183,11 @@ static int r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, + r_magic_free (ck); + ck = NULL; + #endif +-{ + int mod = core->search->align; + if (mod) { + ret = mod; //adelta%addr + deR_ABS(mod-adelta)+1; + goto seek_exit; + } +-} + ret = adelta; //found; + + seek_exit: +diff --git a/libr/include/r_magic.h b/libr/include/r_magic.h +index 488dbf9686ff..bb36c04e153b 100644 +--- a/libr/include/r_magic.h ++++ b/libr/include/r_magic.h +@@ -1,4 +1,4 @@ +-/* radare - LGPL - Copyright 2011-2014 - pancake */ ++/* radare - LGPL - Copyright 2011-2022 - pancake */ + + #ifndef R2_MAGIC_H + #define R2_MAGIC_H +@@ -13,12 +13,6 @@ R_LIB_VERSION_HEADER (r_magic); + + #ifdef R_API + +-#ifdef __EMX__ +-#define PATHSEP ';' +-#else +-#define PATHSEP ':' +-#endif +- + /* limits */ + #ifndef HOWMANY + # define HOWMANY (256 * 1024) /* how much of the file to look at */ +diff --git a/libr/magic/apprentice.c b/libr/magic/apprentice.c +index 6a4428e3f1bd..89eae490ddab 100644 +--- a/libr/magic/apprentice.c ++++ b/libr/magic/apprentice.c +@@ -296,7 +296,7 @@ struct mlist * file_apprentice(RMagic *ms, const char *fn, size_t fn_size, int a + mlist->next = mlist->prev = mlist; + + while (fn) { +- p = strchr (fn, PATHSEP); ++ p = strstr (fn, R_SYS_ENVSEP); + if (p) { + *p++ = '\0'; + } +@@ -2045,6 +2045,7 @@ static ut32 swap4(ut32 sv) { + * swap a quad + */ + static ut64 swap8(ut64 sv) { ++ // we have r_read apis for that, dont dupe! + ut64 rv; + ut8 *s = (ut8 *)(void *)&sv; + ut8 *d = (ut8 *)(void *)&rv; +diff --git a/libr/magic/ascmagic.c b/libr/magic/ascmagic.c +index f7de1f472e3b..59b5ab22bd72 100644 +--- a/libr/magic/ascmagic.c ++++ b/libr/magic/ascmagic.c +@@ -39,6 +39,57 @@ + #include + #include + ++/* ++ * This table maps each EBCDIC character to an (8-bit extended) ASCII ++ * character, as specified in the rationale for the dd(1) command in ++ * draft 11.2 (September, 1991) of the POSIX P1003.2 standard. ++ * ++ * Unfortunately it does not seem to correspond exactly to any of the ++ * five variants of EBCDIC documented in IBM's _Enterprise Systems ++ * Architecture/390: Principles of Operation_, SA22-7201-06, Seventh ++ * Edition, July, 1999, pp. I-1 - I-4. ++ * ++ * Fortunately, though, all versions of EBCDIC, including this one, agree ++ * on most of the printing characters that also appear in (7-bit) ASCII. ++ * Of these, only '|', '!', '~', '^', '[', and ']' are in question at all. ++ * ++ * Fortunately too, there is general agreement that codes 0x00 through ++ * 0x3F represent control characters, 0x41 a nonbreaking space, and the ++ * remainder printing characters. ++ * ++ * This is sufficient to allow us to identify EBCDIC text and to distinguish ++ * between old-style and internationalized examples of text. ++ */ ++ ++static ut8 ebcdic_to_ascii[] = { ++ 0, 1, 2, 3, 156, 9, 134, 127, 151, 141, 142, 11, 12, 13, 14, 15, ++ 16, 17, 18, 19, 157, 133, 8, 135, 24, 25, 146, 143, 28, 29, 30, 31, ++128, 129, 130, 131, 132, 10, 23, 27, 136, 137, 138, 139, 140, 5, 6, 7, ++144, 145, 22, 147, 148, 149, 150, 4, 152, 153, 154, 155, 20, 21, 158, 26, ++' ', 160, 161, 162, 163, 164, 165, 166, 167, 168, 213, '.', '<', '(', '+', '|', ++'&', 169, 170, 171, 172, 173, 174, 175, 176, 177, '!', '$', '*', ')', ';', '~', ++'-', '/', 178, 179, 180, 181, 182, 183, 184, 185, 203, ',', '%', '_', '>', '?', ++186, 187, 188, 189, 190, 191, 192, 193, 194, '`', ':', '#', '@', '\'','=', '"', ++195, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 196, 197, 198, 199, 200, 201, ++202, 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', '^', 204, 205, 206, 207, 208, ++209, 229, 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 210, 211, 212, '[', 214, 215, ++216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, ']', 230, 231, ++'{', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 232, 233, 234, 235, 236, 237, ++'}', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 238, 239, 240, 241, 242, 243, ++'\\',159, 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 244, 245, 246, 247, 248, 249, ++'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 250, 251, 252, 253, 254, 255 ++}; ++ ++/* ++ * Copy buf[0 ... nbytes-1] into out[], translating EBCDIC to ASCII. ++ */ ++R_API void r_magic_from_ebcdic(const ut8 *buf, size_t nbytes, ut8 *out) { ++ size_t i; ++ for (i = 0; i < nbytes; i++) { ++ out[i] = ebcdic_to_ascii[buf[i]]; ++ } ++} ++ + #if !USE_LIB_MAGIC + + #include "file.h" +@@ -147,9 +198,9 @@ return 0; + type = "text"; + code_mime = "unknown"; + } else { +- r_magic_from_ebcdic(buf, nbytes, nbuf); ++ r_magic_from_ebcdic (buf, nbytes, nbuf); + +- if (looks_ascii(nbuf, nbytes, ubuf, &ulen)) { ++ if (looks_ascii (nbuf, nbytes, ubuf, &ulen)) { + code = "EBCDIC"; + type = "character data"; + code_mime = "ebcdic"; +@@ -534,9 +585,7 @@ static int looks_extended(const ut8 *buf, size_t nbytes, unichar *ubuf, size_t * + * Encode Unicode string as UTF-8, returning pointer to character + * after end of string, or NULL if an invalid character is found. + */ +-static ut8 * +-encode_utf8(ut8 *buf, size_t len, unichar *ubuf, size_t ulen) +-{ ++static ut8 * encode_utf8(ut8 *buf, size_t len, unichar *ubuf, size_t ulen) { + size_t i; + ut8 *end = buf + len; + +@@ -732,48 +781,7 @@ static int looks_ucs16(const ut8 *buf, size_t nbytes, unichar *ubuf, size_t *ule + + #endif + +-/* +- * This table maps each EBCDIC character to an (8-bit extended) ASCII +- * character, as specified in the rationale for the dd(1) command in +- * draft 11.2 (September, 1991) of the POSIX P1003.2 standard. +- * +- * Unfortunately it does not seem to correspond exactly to any of the +- * five variants of EBCDIC documented in IBM's _Enterprise Systems +- * Architecture/390: Principles of Operation_, SA22-7201-06, Seventh +- * Edition, July, 1999, pp. I-1 - I-4. +- * +- * Fortunately, though, all versions of EBCDIC, including this one, agree +- * on most of the printing characters that also appear in (7-bit) ASCII. +- * Of these, only '|', '!', '~', '^', '[', and ']' are in question at all. +- * +- * Fortunately too, there is general agreement that codes 0x00 through +- * 0x3F represent control characters, 0x41 a nonbreaking space, and the +- * remainder printing characters. +- * +- * This is sufficient to allow us to identify EBCDIC text and to distinguish +- * between old-style and internationalized examples of text. +- */ +- +-static ut8 ebcdic_to_ascii[] = { +- 0, 1, 2, 3, 156, 9, 134, 127, 151, 141, 142, 11, 12, 13, 14, 15, +- 16, 17, 18, 19, 157, 133, 8, 135, 24, 25, 146, 143, 28, 29, 30, 31, +-128, 129, 130, 131, 132, 10, 23, 27, 136, 137, 138, 139, 140, 5, 6, 7, +-144, 145, 22, 147, 148, 149, 150, 4, 152, 153, 154, 155, 20, 21, 158, 26, +-' ', 160, 161, 162, 163, 164, 165, 166, 167, 168, 213, '.', '<', '(', '+', '|', +-'&', 169, 170, 171, 172, 173, 174, 175, 176, 177, '!', '$', '*', ')', ';', '~', +-'-', '/', 178, 179, 180, 181, 182, 183, 184, 185, 203, ',', '%', '_', '>', '?', +-186, 187, 188, 189, 190, 191, 192, 193, 194, '`', ':', '#', '@', '\'','=', '"', +-195, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 196, 197, 198, 199, 200, 201, +-202, 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', '^', 204, 205, 206, 207, 208, +-209, 229, 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 210, 211, 212, '[', 214, 215, +-216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, ']', 230, 231, +-'{', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 232, 233, 234, 235, 236, 237, +-'}', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 238, 239, 240, 241, 242, 243, +-'\\',159, 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 244, 245, 246, 247, 248, 249, +-'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 250, 251, 252, 253, 254, 255 +-}; +- +-#ifdef notdef ++#if 0 + /* + * The following EBCDIC-to-ASCII table may relate more closely to reality, + * or at least to modern reality. It comes from +@@ -807,13 +815,3 @@ static ut8 ebcdic_1047_to_8859[] = { + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0xB3,0xDB,0xDC,0xD9,0xDA,0x9F + }; + #endif +- +-/* +- * Copy buf[0 ... nbytes-1] into out[], translating EBCDIC to ASCII. +- */ +-R_API void r_magic_from_ebcdic(const ut8 *buf, size_t nbytes, ut8 *out) { +- size_t i; +- for (i = 0; i < nbytes; i++) { +- out[i] = ebcdic_to_ascii[buf[i]]; +- } +-} +diff --git a/libr/magic/d/default/archive b/libr/magic/d/default/archive +index 0f7cb77866a2..17dbed94e1cd 100755 +--- a/libr/magic/d/default/archive ++++ b/libr/magic/d/default/archive +@@ -133,60 +133,62 @@ + # ZIP footer + 0 string PK\005\006 End of Zip archive + +-# OpenOffice.org / KOffice / StarOffice documents +-# From: Abel Cheung +-# Listed here because they are basically zip files +->>30 string mimetype +- +-# KOffice (1.2 or above) formats +->>>50 string vnd.kde. KOffice (>=1.2) +->>>>58 string karbon Karbon document +->>>>58 string kchart KChart document +->>>>58 string kformula KFormula document +->>>>58 string kivio Kivio document +->>>>58 string kontour Kontour document +->>>>58 string kpresenter KPresenter document +->>>>58 string kspread KSpread document +->>>>58 string kword KWord document +- +-# OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7) +->>>50 string vnd.sun.xml. OpenOffice.org 1.x +->>>>62 string writer Writer +->>>>>68 byte !0x2e document +->>>>>68 string .template template +->>>>>68 string .global global document +->>>>62 string calc Calc +->>>>>66 byte !0x2e spreadsheet +->>>>>66 string .template template +->>>>62 string draw Draw +->>>>>66 byte !0x2e document +->>>>>66 string .template template +->>>>62 string impress Impress +->>>>>69 byte !0x2e presentation +->>>>>69 string .template template +->>>>62 string math Math document +- +-# OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8) +-# http://lists.oasis-open.org/archives/office/200505/msg00006.html +->>>50 string vnd.oasis.opendocument. OpenDocument +->>>>73 string text +->>>>>77 byte !0x2d Text +-!:mime application/vnd.oasis.opendocument.text +->>>>>77 string -template Text Template +->>>>>77 string -web HTML Document Template +->>>>>77 string -master Master Document +->>>>73 string graphics Drawing +->>>>>81 string -template Template +->>>>73 string presentation Presentation +->>>>>85 string -template Template +->>>>73 string spreadsheet Spreadsheet +->>>>>84 string -template Template +->>>>73 string chart Chart +->>>>>78 string -template Template +->>>>73 string formula Formula +->>>>>80 string -template Template +->>>>73 string database Database +->>>>73 string image Image ++# commented because barely used and barely used ++# ++# # OpenOffice.org / KOffice / StarOffice documents ++# # From: Abel Cheung ++# # Listed here because they are basically zip files ++# >>30 string mimetype ++# ++# # KOffice (1.2 or above) formats ++# >>>50 string vnd.kde. KOffice (>=1.2) ++# >>>>58 string karbon Karbon document ++# >>>>58 string kchart KChart document ++# >>>>58 string kformula KFormula document ++# >>>>58 string kivio Kivio document ++# >>>>58 string kontour Kontour document ++# >>>>58 string kpresenter KPresenter document ++# >>>>58 string kspread KSpread document ++# >>>>58 string kword KWord document ++# ++# # OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7) ++# >>>50 string vnd.sun.xml. OpenOffice.org 1.x ++# >>>>62 string writer Writer ++# >>>>>68 byte !0x2e document ++# >>>>>68 string .template template ++# >>>>>68 string .global global document ++# >>>>62 string calc Calc ++# >>>>>66 byte !0x2e spreadsheet ++# >>>>>66 string .template template ++# >>>>62 string draw Draw ++# >>>>>66 byte !0x2e document ++# >>>>>66 string .template template ++# >>>>62 string impress Impress ++# >>>>>69 byte !0x2e presentation ++# >>>>>69 string .template template ++# >>>>62 string math Math document ++# ++# # OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8) ++# # http://lists.oasis-open.org/archives/office/200505/msg00006.html ++# >>>50 string vnd.oasis.opendocument. OpenDocument ++# >>>>73 string text ++# >>>>>77 byte !0x2d Text ++# !:mime application/vnd.oasis.opendocument.text ++# >>>>>77 string -template Text Template ++# >>>>>77 string -web HTML Document Template ++# >>>>>77 string -master Master Document ++# >>>>73 string graphics Drawing ++# >>>>>81 string -template Template ++# >>>>73 string presentation Presentation ++# >>>>>85 string -template Template ++# >>>>73 string spreadsheet Spreadsheet ++# >>>>>84 string -template Template ++# >>>>73 string chart Chart ++# >>>>>78 string -template Template ++# >>>>73 string formula Formula ++# >>>>>80 string -template Template ++# >>>>73 string database Database ++# >>>>73 string image Image + + # Zoo archiver + 20 lelong 0xfdc4a7dc Zoo archive data +diff --git a/libr/magic/magic.c b/libr/magic/magic.c +index 70d2b54dbb74..7f7bf77999dc 100644 +--- a/libr/magic/magic.c ++++ b/libr/magic/magic.c +@@ -106,7 +106,7 @@ static const char *file_or_fd(RMagic *ms, const char *inname, int fd) { + * one extra for terminating '\0', and + * some overlapping space for matches near EOF + */ +-#define SLOP (1 + sizeof(union VALUETYPE)) ++#define SLOP (1 + sizeof (union VALUETYPE)) + if (!(buf = malloc (HOWMANY + SLOP))) { + return NULL; + } +@@ -126,7 +126,7 @@ static const char *file_or_fd(RMagic *ms, const char *inname, int fd) { + ispipe = true; + } + } else { +- int flags = O_RDONLY|O_BINARY; ++ int flags = O_RDONLY | O_BINARY; + + if (stat (inname, &sb) == 0 && S_ISFIFO (sb.st_mode)) { + #if O_NONBLOCK diff --git a/radare2-5.7.6-use_magic.patch b/radare2-5.7.6-use_magic.patch new file mode 100644 index 0000000..a6d58aa --- /dev/null +++ b/radare2-5.7.6-use_magic.patch @@ -0,0 +1,40 @@ +--- radare2-5.6.6-orig/libr/magic/meson.build 2022-03-22 20:06:43.000000000 +0100 ++++ radare2-5.6.6/libr/magic/meson.build 2022-04-13 02:36:10.031944601 +0200 +@@ -1,14 +1,3 @@ +-r_magic_sources = [ +- 'apprentice.c', +- 'ascmagic.c', +- 'fsmagic.c', +- 'funcs.c', +- 'is_tar.c', +- 'magic.c', +- # XXX not used? 'print.c', +- 'softmagic.c' +-] +- + r_magic_deps = [r_util_dep] + if get_option('blob') + r_magic_static_deps = [r_util_static_dep] +@@ -20,8 +9,22 @@ + if get_option('blob') + r_magic_static_deps += [sys_magic] + endif ++ r_magic_sources = [ ++ 'magic-libmagic.c', ++ 'ascmagic-libmagic.c', ++ ] + else + message('Use bundled magic library') ++ r_magic_sources = [ ++ 'apprentice.c', ++ 'ascmagic.c', ++ 'fsmagic.c', ++ 'funcs.c', ++ 'is_tar.c', ++ 'magic.c', ++ # XXX not used? 'print.c', ++ 'softmagic.c' ++ ] + endif + + r_magic = library('r_magic', r_magic_sources, diff --git a/radare2-5.8.2-meson-sdb.patch b/radare2-5.8.2-meson-sdb.patch new file mode 100644 index 0000000..e4bf64d --- /dev/null +++ b/radare2-5.8.2-meson-sdb.patch @@ -0,0 +1,72 @@ +diff -ru -N radare2-5.8.2/libr/syscall/d/gen.py radare2-5.8.2.new/libr/syscall/d/gen.py +--- radare2-5.8.2/libr/syscall/d/gen.py 1970-01-01 01:00:00.000000000 +0100 ++++ radare2-5.8.2.new/libr/syscall/d/gen.py 2023-02-26 00:13:15.616002799 +0100 +@@ -0,0 +1,29 @@ ++#!/usr/bin/env python ++# args [sdbpath] [input] [output] ++import os ++import sys ++import subprocess ++ ++ ++try: ++ sdb_exe = sys.argv[1] ++ _input = sys.argv[2] ++ _output = sys.argv[3] ++ _tmpfile = _input + ".tmp" ++ with open(_input) as lines: ++ res = "" ++ for line in lines: ++ kv = line.rstrip().split("=", 1) ++ if kv[0] == "_": ++ res += line ++ else: ++ vv = kv[1].split(",") ++ res += vv[0] + "." + vv[1] + "=" + kv[0] + "\n" ++ res += line ++ with open(_tmpfile, "w") as file: ++ file.write(res) ++ subprocess.call([sdb_exe, _output, "==", _tmpfile]) ++except Exception as e: ++ print(e) ++ print("Usage: gen.py [sdb_exe] [input] [output]") ++ +diff -ru -N radare2-5.8.2/libr/syscall/d/meson.build radare2-5.8.2.new/libr/syscall/d/meson.build +--- radare2-5.8.2/libr/syscall/d/meson.build 2023-01-23 11:53:42.000000000 +0100 ++++ radare2-5.8.2.new/libr/syscall/d/meson.build 2023-02-26 00:13:15.617002836 +0100 +@@ -35,7 +35,7 @@ + gen_cmd = sdb_gen_cmd_cgen + else + outfile = '@0@.sdb'.format(file) +- gen_cmd = sdb_gen_cmd ++ gen_cmd = syscall_sdb_gen_cmd + endif + + r_syscall_d_sources += custom_target(outfile, +diff -ru -N radare2-5.8.2/meson.build radare2-5.8.2.new/meson.build +--- radare2-5.8.2/meson.build 2023-01-23 11:53:42.000000000 +0100 ++++ radare2-5.8.2.new/meson.build 2023-02-26 00:13:15.619002909 +0100 +@@ -1,6 +1,7 @@ + project('radare2', 'c', license : 'LGPL3', meson_version : '>=0.49', version : '5.8.2') + + py3_exe = import('python').find_installation('python3') ++gen_py = '@0@/libr/syscall/d/gen.py'.format(meson.current_source_dir()) + git_exe = find_program('git', required: false) + pkgconfig_mod = import('pkgconfig') + +@@ -553,6 +554,15 @@ + '@INPUT@' + ] + ++py_cmd = '__import__("os").readlink(r"@0@"))'.format(repo) ++syscall_sdb_gen_cmd = [ ++ py3_exe, ++ gen_py, ++ sdb_exe, ++ '@INPUT@', ++ '@OUTPUT@', ++] ++ + # handle spp dependency + spp_files = [ + 'shlr/spp/spp.c' diff --git a/radare2-5.8.8-CVE-2023-4322.patch b/radare2-5.8.8-CVE-2023-4322.patch new file mode 100644 index 0000000..2e80af3 --- /dev/null +++ b/radare2-5.8.8-CVE-2023-4322.patch @@ -0,0 +1,120 @@ +diff -ru radare2-5.8.8/libr/arch/p/bf/plugin.c radare2-5.8.8.new/libr/arch/p/bf/plugin.c +--- radare2-5.8.8/libr/arch/p/bf/plugin.c 2023-06-08 15:54:42.000000000 +0200 ++++ radare2-5.8.8.new/libr/arch/p/bf/plugin.c 2023-10-26 14:52:41.893960711 +0200 +@@ -13,8 +13,8 @@ + } + + static int getid(char ch) { +- const char *keys = "[]<>+-,."; +- const char *cidx = strchr (keys, ch); ++ const char *const keys = "[]<>+-,."; ++ const char *const cidx = strchr (keys, ch); + return cidx? cidx - keys + 1: 0; + } + +@@ -136,13 +136,11 @@ + #define BUFSIZE_INC 32 + static bool decode(RArchSession *as, RAnalOp *op, RArchDecodeMask mask) { + int len = op->size; +- const ut8 *_buf = op->bytes; +- const ut64 addr = op->addr; + if (len < 1) { + return false; + } +- +- ut8 *buf = (ut8*)_buf; // XXX ++ ut8 *buf = op->bytes; ++ const ut64 addr = op->addr; + ut64 dst = 0LL; + if (!op) { + return 1; +@@ -169,29 +167,32 @@ + } + r_strbuf_set (&op->esil, "1,pc,-,brk,=[4],4,brk,+="); + #if 1 +- { ++ if (len > 1) { + const ut8 *p = buf + 1; + int lev = 0, i = 1; + len--; + while (i < len && *p) { +- if (*p == '[') { ++ switch (*p) { ++ case '[': + lev++; +- } +- if (*p == ']') { ++ break; ++ case ']': + lev--; +- if (lev == -1) { +- dst = addr + (size_t)(p - buf) + 1; ++ if (lev < 1) { ++ size_t delta = p - buf; ++ dst = addr + (size_t)delta + 1; + op->jump = dst; + r_strbuf_set (&op->esil, "1,pc,-,brk,=[4],4,brk,+=,"); + goto beach; + } +- } +- if (*p == 0x00 || *p == 0xff) { ++ break; ++ case 0: ++ case 0xff: + op->type = R_ANAL_OP_TYPE_ILL; + goto beach; + } + if (read_at && i == len - 1) { +- break; ++#if 0 + // XXX unnecessary just break + int new_buf_len = len + 1 + BUFSIZE_INC; + ut8 *new_buf = calloc (new_buf_len, 1); +@@ -203,6 +204,9 @@ + p = buf + i; + len += BUFSIZE_INC; + } ++#else ++ break; ++#endif + } + p++; + i++; +Only in radare2-5.8.8.new/libr/arch/p/bf: plugin.c.orig +diff -ru radare2-5.8.8/libr/core/cmd_anal.c radare2-5.8.8.new/libr/core/cmd_anal.c +--- radare2-5.8.8/libr/core/cmd_anal.c 2023-06-08 15:54:42.000000000 +0200 ++++ radare2-5.8.8.new/libr/core/cmd_anal.c 2023-10-26 14:56:01.978360519 +0200 +@@ -8700,9 +8700,9 @@ + isValidCall = false; + } + if (isValidCall) { +- ut8 buf[4] = {0}; +- r_io_read_at (core->io, op.jump, buf, 4); +- isValidCall = memcmp (buf, "\x00\x00\x00\x00", 4); ++ ut8 zbuf[4] = {0}; ++ r_io_read_at (core->io, op.jump, zbuf, 4); ++ isValidCall = memcmp (zbuf, "\x00\x00\x00\x00", 4); + } + if (isValidCall) { + #if JAYRO_03 +@@ -8798,9 +8798,8 @@ + } + + static void cmd_sdbk(Sdb *db, const char *input) { +- char *out = (input[0] == ' ') +- ? sdb_querys (db, NULL, 0, input + 1) +- : sdb_querys (db, NULL, 0, "*"); ++ const char *arg = (input[0] == ' ')? input + 1: "*"; ++ char *out = sdb_querys (db, NULL, 0, arg); + if (out) { + r_cons_println (out); + free (out); +@@ -9098,7 +9097,7 @@ + } + + static void cmd_anal_ucall_ref(RCore *core, ut64 addr) { +- RAnalFunction * fcn = r_anal_get_function_at (core->anal, addr); ++ RAnalFunction *fcn = r_anal_get_function_at (core->anal, addr); + if (fcn) { + r_cons_printf (" ; %s", fcn->name); + } else { diff --git a/radare2-5.8.8-CVE-2023-5686.patch b/radare2-5.8.8-CVE-2023-5686.patch new file mode 100644 index 0000000..be97561 --- /dev/null +++ b/radare2-5.8.8-CVE-2023-5686.patch @@ -0,0 +1,20 @@ +diff -ru radare2-5.8.8/shlr/java/code.c radare2-5.8.8.new/shlr/java/code.c +--- radare2-5.8.8/shlr/java/code.c 2023-06-08 15:54:42.000000000 +0200 ++++ radare2-5.8.8.new/shlr/java/code.c 2023-10-26 14:42:41.822081941 +0200 +@@ -191,10 +191,12 @@ + case 0xa6: // if_acmpne + case 0xa7: // goto + case 0xa8: // jsr +- snprintf (output, outlen, "%s 0x%04"PFMT64x, JAVA_OPS[idx].name, +- (addr+(short)USHORT (bytes, 1))); +- output[outlen-1] = 0; +- return update_bytes_consumed (JAVA_OPS[idx].size); ++ if (len > 3) { ++ const short delta = USHORT (bytes, 1); ++ snprintf (output, outlen, "%s 0x%04"PFMT64x, JAVA_OPS[idx].name, addr + delta); ++ output[outlen-1] = 0; ++ return update_bytes_consumed (JAVA_OPS[idx].size); ++ } + // XXX - Figure out what constitutes the [] value + case 0xab: // tableswitch + case 0xaa: // tableswitch diff --git a/radare2-5.9.0-use_magic.patch b/radare2-5.9.0-use_magic.patch new file mode 100644 index 0000000..c8b031e --- /dev/null +++ b/radare2-5.9.0-use_magic.patch @@ -0,0 +1,42 @@ +diff -ru radare2-5.9.0.old/libr/magic/meson.build radare2-5.9.0.new/libr/magic/meson.build +--- radare2-5.9.0.old/libr/magic/meson.build 2024-03-31 17:01:15.000000000 +0200 ++++ radare2-5.9.0.new/libr/magic/meson.build 2024-04-21 00:48:57.545114120 +0200 +@@ -1,15 +1,3 @@ +-r_magic_sources = [ +- 'apprentice.c', +- 'ascmagic.c', +- 'fsmagic.c', +- 'funcs.c', +- 'mdump.c', +- 'is_tar.c', +- 'magic.c', +- # XXX not used? 'print.c', +- 'softmagic.c' +-] +- + r_magic_deps = [r_util_dep] + if get_option('blob') + r_magic_static_deps = [r_util_static_dep] +@@ -21,8 +9,22 @@ + if get_option('blob') + r_magic_static_deps += [sys_magic] + endif ++ r_magic_sources = [ ++ 'magic-libmagic.c', ++ 'ascmagic-libmagic.c', ++ ] + else + message('Use bundled magic library') ++ r_magic_sources = [ ++ 'apprentice.c', ++ 'ascmagic.c', ++ 'fsmagic.c', ++ 'funcs.c', ++ 'is_tar.c', ++ 'magic.c', ++ # XXX not used? 'print.c', ++ 'softmagic.c' ++ ] + endif + + r_magic = library('r_magic', r_magic_sources, diff --git a/radare2-5.9.8-dec99.patch b/radare2-5.9.8-dec99.patch new file mode 100644 index 0000000..53a9fa1 --- /dev/null +++ b/radare2-5.9.8-dec99.patch @@ -0,0 +1,21 @@ +diff -ru radare2-5.9.8.orig/shlr/qjs/src/quickjs.c radare2-5.9.8.new/shlr/qjs/src/quickjs.c +--- radare2-5.9.8.orig/shlr/qjs/src/quickjs.c 2024-11-19 12:38:30.000000000 +0100 ++++ radare2-5.9.8.new/shlr/qjs/src/quickjs.c 2024-11-22 14:34:10.546707808 +0100 +@@ -11311,6 +11311,8 @@ + char dest[minimum_length(JS_ECVT_BUF_SIZE)], + size_t size, int *decpt) + { ++ int i; ++ + if (n_digits == 0) { + /* find the minimum number of digits (XXX: inefficient but simple) */ + // TODO(chqrlie) use direct method from quickjs-printf +@@ -11360,7 +11362,7 @@ + return n_digits; /* truncate the 2 extra digits */ + } + /* round up in the string */ +- for(int i = n_digits;; i--) { ++ for(i = n_digits;; i--) { + /* ignore the locale specific decimal point */ + if (is_digit(dest[i])) { + if (dest[i]++ < '9') diff --git a/radare2-5.9.8-hfs-cve.patch b/radare2-5.9.8-hfs-cve.patch new file mode 100644 index 0000000..c4e58bf --- /dev/null +++ b/radare2-5.9.8-hfs-cve.patch @@ -0,0 +1,36 @@ +From 984ad6ae4ebbc3a01cf1209e05377b5d1d6221f4 Mon Sep 17 00:00:00 2001 +From: pancake +Date: Thu, 2 Jan 2025 13:03:34 +0100 +Subject: [PATCH] CVE-2024-56737 - Fix buffer overflow in the HFS parser from + grub2 ##crash + +--- + shlr/grub/fs/hfs.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/shlr/grub/fs/hfs.c b/shlr/grub/fs/hfs.c +index 33060d5d5fe25..98f717c4c47b4 100644 +--- a/shlr/grub/fs/hfs.c ++++ b/shlr/grub/fs/hfs.c +@@ -375,7 +375,9 @@ grub_hfs_mount (grub_disk_t disk) + volume name. */ + key.parent_dir = grub_cpu_to_be32 (1); + key.strlen = data->sblock.volname[0]; +- grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1)); ++ ///grub_strcpy ((char *) key.str, (char *) (data->sblock.volname + 1)); ++ strncpy (key.str, (char *) (data->sblock.volname + 1), sizeof (key.str) - 1); ++ key.str[sizeof (key.str) - 1] = 0; + + int depth = 0; + if (grub_hfs_find_node (data, (char *) &key, data->cat_root, +@@ -965,7 +967,9 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path, + + key.parent_dir = grub_cpu_to_be32 (inode); + key.strlen = grub_strlen (path); +- grub_strcpy ((char *) (key.str), path); ++ // grub_strcpy ((char *) (key.str), path); ++ strncpy (key.str, (char *) path, sizeof (key.str) - 1); ++ key.str[sizeof (key.str) - 1] = 0; + + /* Lookup this node. */ + if (! grub_hfs_find_node (data, (char *) &key, data->cat_root, diff --git a/radare2-5.9.8-magic-cve.patch b/radare2-5.9.8-magic-cve.patch new file mode 100644 index 0000000..9e76c3b --- /dev/null +++ b/radare2-5.9.8-magic-cve.patch @@ -0,0 +1,47 @@ +From 9c92960f8606be2decf88cdcec7a7ab53ff13b4b Mon Sep 17 00:00:00 2001 +From: tabudz +Date: Wed, 19 Feb 2025 23:42:14 +0800 +Subject: [PATCH 1/2] PR/454: Fix memory corruption when the continuation level + jumps by more than 20 in a single step. + +--- + libr/magic/funcs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libr/magic/funcs.c b/libr/magic/funcs.c +index 7356dc0c93f77..14687bf7be8f0 100644 +--- a/libr/magic/funcs.c ++++ b/libr/magic/funcs.c +@@ -322,7 +322,7 @@ const char *__magic_file_getbuffer(RMagic *ms) { + + int __magic_file_check_mem(RMagic *ms, unsigned int level) { + if (level >= ms->c.len) { +- size_t len = (ms->c.len += 20) * sizeof (*ms->c.li); ++ size_t len = (ms->c.len = 20 + level) * sizeof (*ms->c.li); + ms->c.li = (!ms->c.li) ? malloc (len) : + realloc (ms->c.li, len); + if (!ms->c.li) { + +From 030e74cd136044e28828ab52615ce929693bae7a Mon Sep 17 00:00:00 2001 +From: pancake +Date: Wed, 19 Feb 2025 17:32:21 +0100 +Subject: [PATCH 2/2] Update libr/magic/funcs.c + +--- + libr/magic/funcs.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libr/magic/funcs.c b/libr/magic/funcs.c +index 14687bf7be8f0..52e3819f0e04e 100644 +--- a/libr/magic/funcs.c ++++ b/libr/magic/funcs.c +@@ -322,7 +322,8 @@ const char *__magic_file_getbuffer(RMagic *ms) { + + int __magic_file_check_mem(RMagic *ms, unsigned int level) { + if (level >= ms->c.len) { +- size_t len = (ms->c.len = 20 + level) * sizeof (*ms->c.li); ++ ms->c.len = level + 20; ++ size_t len = ms->c.len * sizeof (*ms->c.li); + ms->c.li = (!ms->c.li) ? malloc (len) : + realloc (ms->c.li, len); + if (!ms->c.li) { diff --git a/radare2-5.9.8-zlib-cve.patch b/radare2-5.9.8-zlib-cve.patch new file mode 100644 index 0000000..02ada03 --- /dev/null +++ b/radare2-5.9.8-zlib-cve.patch @@ -0,0 +1,30 @@ +From b49d2f0b84d424ec7fbf47138bf6acc6b18e1b0d Mon Sep 17 00:00:00 2001 +From: tabudz +Date: Tue, 18 Feb 2025 11:28:15 +0800 +Subject: [PATCH] Fix a bug when getting a gzip header extra field with + inflate(). If the extra field was larger than the space the user provided + with inflateGetHeader(), and if multiple calls of inflate() delivered the + extra header data, then there could be a buffer overflow of the provided + space. This commit assures that provided space is not exceeded. + +--- + shlr/zip/zlib/inflate.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/shlr/zip/zlib/inflate.c b/shlr/zip/zlib/inflate.c +index e9ed74cff3279..2ecfb4876d155 100644 +--- a/shlr/zip/zlib/inflate.c ++++ b/shlr/zip/zlib/inflate.c +@@ -755,9 +755,10 @@ int ZEXPORT inflate(z_streamp strm, int flush) + copy = state->length; + if (copy > have) copy = have; + if (copy) { ++ len = state->head->extra_len - state->length; + if (state->head != Z_NULL && +- state->head->extra != Z_NULL) { +- len = state->head->extra_len - state->length; ++ state->head->extra != Z_NULL && ++ len < state->head->extra_max) { + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); diff --git a/radare2.spec b/radare2.spec index 72c3aef..d0d3c71 100644 --- a/radare2.spec +++ b/radare2.spec @@ -1,12 +1,13 @@ Name: radare2 Summary: The reverse engineering framework -Version: 5.6.4 -%global rel 1 +Version: 5.9.8 URL: https://radare.org/ -VCS: https://github.com/radareorg/radare2 +%global vcsurl https://github.com/radareorg/radare2 +VCS: git:%{vcsurl} # https://github.com/radareorg/radare2/releases -# %%if 0%%{?rhel} && 0i%%{?rhel} == 8 + +# %%if 0%%{?rhel} && 0%%{?rhel} == 8 # Radare2 fails to build on EPEL8+s390x # https://bugzilla.redhat.com/show_bug.cgi?id=1960046 # https://docs.fedoraproject.org/en-US/packaging-guidelines/#_architecture_build_failures @@ -16,64 +17,102 @@ VCS: https://github.com/radareorg/radare2 # by default it builds from the released version of radare2 # to build from git use rpmbuild --without=releasetag -%bcond_without releasetag +%bcond_without releasetag %global gituser radareorg %global gitname radare2 - -%global gitdate 20220228 -%global commit b636941cefcbc12b2031054e736b1f8e5458be32 +%global gitdate 20241119 +%global commit 4eb49d5ad8c99eaecc8850a2f10bad407067c898 %global shortcommit %(c=%{commit}; echo ${c:0:7}) +# autorelease not available on epel7 +%if ( 0%{?rhel} && 0%{?rhel} <= 7 ) +%global autorelease 1%{?dist} +%endif + %if %{with releasetag} -Release: %{rel}%{?dist} -Source0: https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz +Release: %autorelease +Source0: %{vcsurl}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz %else -Release: 0.%{rel}.%{gitdate}git%{shortcommit}%{?dist} -Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{commit}.zip#/%{name}-%{version}-%{shortcommit}.zip +Release: %autorelease -s %{gitdate}git%{shortcommit} +Source0: %{vcsurl}/archive/%{commit}/%{name}-%{commit}.tar.gz#/%{name}-%{version}-git%{gitdate}-%{shortcommit}.tar.gz %endif -# Declaration of variable in the for loop requires at least c99 compatibility mode -# This is specific to 5.6.0 and is already fixed in the git -Patch0: radare2-5.6.0-dec99.patch +# Specific to Fedora - build with system libraries +Patch1: radare2-5.6.6-use_openssl.patch +Patch3: radare2-5.9.0-use_magic.patch + +# using system-wide LZ4 should be done using conditionals +# Patch4: radare2-5.6.6-use_lz4.patch + +# CVE-2023-4322 - radare2: Heap-based Buffer Overflow in the bf dissassembler +# fix should be part of 5.9.0 +# https://github.com/radareorg/radare2/commit/ba919adb74ac368bf76b150a00347ded78b572dd +# Patch5: radare2-5.8.8-CVE-2023-4322.patch + +# CVE-2023-5686 - radare2: heap-buffer-overflow in /radare2/shlr/java/code.c:211:21 in java_print_opcode +# fix should be part of 5.9.0 +# https://github.com/radareorg/radare2/commit/1bdda93e348c160c84e30da3637acef26d0348de +# Patch6: radare2-5.8.8-CVE-2023-5686.patch + +# Build reports need for C99 compatibility mode for the index type declaration in the for cycle. +# As rest of the radare2 is strictly defining all index variables prior to for cycle, it is recommended +# to change this one as well +Patch7: radare2-5.9.8-dec99.patch + +# CVE-2025-1744 - Potential Vulnerability in zlib Library +# https://github.com/radareorg/radare2/pull/23969 +Patch8: https://github.com/radareorg/radare2/pull/23969.patch#/radare2-5.9.8-zlib-cve.patch + +# CVE-2025-1864 - Potential Vulnerability in magic Library +# https://github.com/radareorg/radare2/pull/23981 +Patch9: https://github.com/radareorg/radare2/pull/23981.patch#/radare2-5.9.8-magic-cve.patch + +# CVE-2024-56737 - Fix buffer overflow in the HFS parser from grub2 +# https://github.com/radareorg/radare2/commit/984ad6ae4ebbc3a01cf1209e05377b5d1d6221f4.patch#/radare2-5.9.8-hfs-cve.patch +# https://github.com/advisories/GHSA-9vr3-263w-c6mj +Patch10: https://github.com/radareorg/radare2/commit/984ad6ae4ebbc3a01cf1209e05377b5d1d6221f4.patch#/radare2-5.9.8-hfs-cve.patch -License: LGPLv3+ and GPLv2+ and BSD and MIT and ASL 2.0 and MPLv2.0 and zlib + +License: LGPL-3.0-or-later AND GPL-2.0-or-later AND BSD-2-Clause AND BSD-3-Clause AND MIT AND Apache-2.0 AND MPL-2.0 AND Zlib # Radare2 as a package is targeting to be licensed/compiled as LGPLv3+ # during build for Fedora the GPL code is not omitted so effectively it is GPLv2+ # some code has originally different license: -# libr/asm/arch/ - GPLv2+, MIT, GPLv3 +# libr/asm/arch/ - GPLv2+, MIT, GPLv3 # libr/bin/format/pe/dotnet - Apache License Version 2.0 -# libr/hash/xxhash.c - 2 clause BSD -# libr/util/qrcode.c - MIT -# shlr/grub/grubfs.c - LGPL -# shlr/java - Apache 2.0 -# shlr/sdb/src - MIT -# shlr/lz4 - 3 clause BSD (system installed shared lz4 is used instead) -# shlr/spp - MIT -# shlr/squashfs/src - GPLv2+ -# shlr/tcc - LGPLv2+ -# shlr/udis86 - 2 clause BSD -# shlr/wind - LGPL v3+ -# shlr/spp - MIT -# shlr/zip/zlib - zlib/libpng License (system installed shared libzip is used instead) -# shlr/zip/zip - 3 clause BSD (system installed shared zlib is used instead) -# shlr/ptrace-wrap - LGPL v3+ -# shlr/tree-sitter - MIT +# libr/hash/xxhash.c - 2 clause BSD +# libr/util/qrcode.c - MIT +# shlr/grub/grubfs.c - LGPL +# shlr/java - Apache 2.0 +# shlr/sdb/src - MIT +# shlr/lz4 - 3 clause BSD (system installed shared lz4 is used instead) +# shlr/squashfs/src - GPLv2+ +# libr/parse/c - LGPLv2+ +# shlr/udis86 - 2 clause BSD +# shlr/winkd - LGPL v3+ +# shlr/spp - MIT +# shlr/zip/zlib - zlib/libpng License (system installed shared libzip is used instead) +# shlr/zip/zip - 3 clause BSD (system installed shared zlib is used instead) +# shlr/ptrace-wrap - LGPL v3+ +# shlr/tree-sitter - MIT +# shlr/mpc - 2 clause BSD +# shlr/yxml - MIT +# shlr/qjs - MIT # Removed from the final package because of the presence of minified JS and # absence of the source JS - this should be packaged with radare2-webui -# shlr/www/m - Apache-2.0 -# shlr/www/enyo/vendors/jquery-ui.min.js - GPL + MIT +# shlr/www/m - Apache-2.0 +# shlr/www/enyo/vendors/jquery-ui.min.js - GPL + MIT # shlr/www/enyo/vendors/jquery.layout-latest.min.js - GPL + MIT -# shlr/www/enyo/vendors/jquery.scrollTo.min.js - MIT -# shlr/www/enyo/vendors/lodash.min.js - lodash license -# shlr/www/enyo/vendors/joint.* - Mozilla MPL 2.0 -# shlr/www/enyo/vendors/jquery.min.js - Apache License version 2.0 -# shlr/www/p/vendors/jquery* - GPL + MIT -# shlr/www/p/vendors/dagre*|graphlib* - 3 clause BSD -# shlr/www/p/vendors/jquery.onoff.min.js - MIT +# shlr/www/enyo/vendors/jquery.scrollTo.min.js - MIT +# shlr/www/enyo/vendors/lodash.min.js - lodash license +# shlr/www/enyo/vendors/joint.* - Mozilla MPL 2.0 +# shlr/www/enyo/vendors/jquery.min.js - Apache License version 2.0 +# shlr/www/p/vendors/jquery* - GPL + MIT +# shlr/www/p/vendors/dagre*|graphlib* - 3 clause BSD +# shlr/www/p/vendors/jquery.onoff.min.js - MIT BuildRequires: sed BuildRequires: gcc @@ -82,7 +121,12 @@ BuildRequires: ninja-build BuildRequires: pkgconfig # xxhash-devel BuildRequires: pkgconfig(libxxhash) + +# version of libzip on rhel7 is too old +%if 0%{?fedora} || 0%{?rhel} >= 8 BuildRequires: pkgconfig(libzip) +%endif + BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(liblz4) BuildRequires: pkgconfig(capstone) >= 3.0.4 @@ -125,7 +169,10 @@ Requires: %{name}-common = %{version}-%{release} # compiled with -D use_sys_xxhash=true instead # ./libr/hash/{md4,md5,sha1,sha2}.{c,h} -# compiled with -D use_sys_openssl=true instead +# ./libr/util/big.c +# could be compiled with -D use_sys_openssl=true instead, +# but is currently not maintained so using embedded R2 implementations +# for hashing # ./shlr/spp/README.md # SPP stands for Simple Pre-Processor, a templating language. @@ -135,7 +182,7 @@ Provides: bundled(spp) = 1.2.0 # ./shlr/sdb/README.md # sdb is a simple string key/value database based on djb's cdb # https://github.com/radare/sdb -Provides: bundled(sdb) = 1.7.0 +Provides: bundled(sdb) = 1.8.6 # ./shlr/sdb/src/json/README # Based on js0n with a lot of modifications @@ -149,7 +196,7 @@ Provides: bundled(js0n) = 2018 # version from 2010/11/21 00:02:30, version of files ranges from v1.11 to v1.20 Provides: bundled(openbsdregex) = 1.11 -# ./shlr/tcc/README.md +# ./libr/parse/c/README.md # This is a stripped down version of tcc without the code generators and heavily modified. Provides: bundled(tcc) = 0.9.26 @@ -169,7 +216,7 @@ Provides: bundled(vavrdisasm) = 1.6 # It is not clear which version has been copied Provides: bundled(grub2) = 1.99~beta0 -# ./shlr/ptrace-wrap +# ./libr/io/ptrace_wrap.c # https://github.com/thestr4ng3r/ptrace-wrap Provides: bundled(ptrace-wrap) = 20181018 @@ -177,6 +224,21 @@ Provides: bundled(ptrace-wrap) = 20181018 # https://github.com/tree-sitter/tree-sitter Provides: bundled(tree-sitter) = 0.17.2 +# ./shlr/mpc +# https://github.com/orangeduck/mpc +Provides: bundled(mpc) = 0.8.7 + +# ./shlr/yxml +# https://dev.yorhel.nl/yxml +Provides: bundled(yxml) = 20201108 + +# ./shlr/qjs +# https://github.com/quickjs-ng/quickjs +# License: MIT +Provides: bundled(quickjs-ng) = 0.7.0 + +# and likely some more in libr/... borrowed from other projects + %description The radare2 is a reverse-engineering framework that is multi-architecture, multi-platform, and highly scriptable. Radare2 provides a hexadecimal @@ -217,11 +279,23 @@ information sed -i -e "s|%{version}-git|%{version}|g;" configure configure.acr %endif # Removing zip/lzip files because we use system dependencies +# version of libzip on rhel7 is too old, use the embedded one instead +%if 0%{?fedora} || 0%{?rhel} >= 8 rm -rf shlr/zip/{zip,zlib,include} -# Not removing the LZ4 source code - hardcoded -# rm -rf shlr/lz4 +%endif + +# Remove lx4 files because we use system dependencies +rm -rf shlr/lz4/{deps.mk,LICENSE,lz4.*,Makefile,README.md} # Remove xxhash files because we use system dependencies rm -f libr/hash/xxhash.c libr/hash/xxhash.h +# Remove magic files because we use system dependencies +awk 'BEGIN {p=1} /#if USE_LIB_MAGIC/ {p=2; next} p==2 && /#else/ {p=0} p>0 {print}' libr/magic/magic.c > libr/magic/magic.c.stripped +awk 'BEGIN {p=1} /#if !USE_LIB_MAGIC/ {p=0; next} p==2 && /#else/ {p=0} p>0 {print}' libr/magic/ascmagic.c > libr/magic/ascmagic.c.stripped +rm -rf libr/magic/*.c +mv libr/magic/magic.c.stripped libr/magic/magic-libmagic.c +mv libr/magic/ascmagic.c.stripped libr/magic/ascmagic-libmagic.c +# Remove openssl files because we use system dependencies +# rm -f libr/hash/{md4,md5,sha1,sha2}.[ch] # Webui contains pre-build and/or minimized versions of JS libraries without source code # Consider installing the web-interface from https://github.com/radare/radare2-webui @@ -230,23 +304,29 @@ echo "The radare2 source usually comes with a pre-built version of the web-inter echo "This has been removed in the Fedora package to follow the Fedora Packaging Guidelines." >> ./shlr/www/README.Fedora echo "Available under https://github.com/radare/radare2-webui" >> ./shlr/www/README.Fedora -%if 0%{?rhel} && 0%{?rhel} == 8 -# Meson on EPEL8 is older than meson on EPEL7 and older than recommended one -# on EPEL8 downgrade the recommendation in meson.build and pray -# meson_version : '>=0.50.1' => meson_version : '>=0.49.1' -sed -i -e "s|meson_version : '>=......'|meson_version : '>=0.49.1'|;" meson.build +%if 0%{?rhel} && 0%{?rhel} <= 8 +# Meson on EPEL8 / EPEL7 is older than recommended one +sed -i -e "s|meson_version : '>=......'|meson_version : '>=0.47.2'|;" meson.build %endif +# On RHEL8 the shabeng for "/usr/bin/env -S" is mangled wrongly as "/usr/bin/-S" +sed -i -e "s|/usr/bin/env -S r2|/usr/bin/r2|" ./scripts/licenses.r2.js %build # Whereever possible use the system-wide libraries instead of bundles +# --sanitize=address,undefined,signed-integer-overflow \ + %meson \ -Duse_sys_magic=true \ +%if 0%{?fedora} || 0%{?rhel} >= 8 -Duse_sys_zip=true \ +%else + -Duse_sys_zip=false \ +%endif -Duse_sys_zlib=true \ -Duse_sys_lz4=true \ -Duse_sys_xxhash=true \ - -Duse_sys_openssl=true \ + -Duse_ssl=true \ -Duse_libuv=true \ %ifarch s390x -Ddebugger=false \ @@ -284,7 +364,7 @@ mkdir -p %{buildroot}%{_libdir}/%{name}/%{version} %files %license COPYING COPYING.LESSER %doc CONTRIBUTING.md DEVELOPERS.md README.md -%doc doc/3D/ doc/node.js/ doc/pdb/ doc/sandbox/ +%doc doc/3D/ doc/pdb/ doc/sandbox/ %doc doc/avr.md doc/brainfuck.md doc/calling-conventions.md doc/debug.md %doc doc/esil.md doc/gdb.md doc/gprobe.md doc/intro.md doc/io.md doc/rap.md %doc doc/siol.md doc/strings.md doc/windbg.md doc/yara.md @@ -317,220 +397,13 @@ mkdir -p %{buildroot}%{_libdir}/%{name}/%{version} %{_datadir}/%{name}/%{version}/opcodes %{_datadir}/%{name}/%{version}/syscall %{_datadir}/%{name}/%{version}/charsets +%{_datadir}/%{name}/%{version}/platform +%{_datadir}/%{name}/%{version}/scripts + %dir %{_datadir}/%{name} %dir %{_datadir}/doc/%{name} %dir %{_datadir}/%{name}/%{version} %changelog -* Mon Feb 28 2022 Michal Ambroz 5.6.4-1 -- bump to 5.6.4 - -* Wed Feb 09 2022 Michal Ambroz 5.6.2-1 -- bump to 5.6.2 -- disable multithreading for now to be able to compile with iaito - -* Wed Feb 09 2022 Michal Ambroz 5.6.0-2 -- patch declaration of int i in for cycle to avoid C99 mode on EPEL7 - -* Wed Feb 09 2022 Michal Ambroz 5.6.0-1 -- bump to 5.6.0 -- fix CVE-2022-0419 -- fix CVE-2021-4021 - -* Wed Jan 26 2022 Henrik Nordstrom - 5.5.4-1 -- Update to version 5.5.4 -- should be fixing CVE-2021-4021 - -* Fri Jan 21 2022 Fedora Release Engineering - 5.4.2-1.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Thu Sep 23 2021 Henrik Nordstrom - 5.4.2-1 -- Update to version 5.4.2 - -* Sat Sep 18 2021 Henrik Nordstrom - 5.4.0-1 -- Update to version 5.4.0 -- Fix CVE-2021-3673 - -* Fri Jul 23 2021 Fedora Release Engineering - 5.3.1-1.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Fri Jun 11 2021 Michal Ambroz 5.3.1-1 -- bump to 5.3.1 - -* Wed Jun 09 2021 Michal Ambroz 5.3.0-1 -- re-enable build for s390x on EPEL8 (libuv should be available for 8.4) -- bump to 5.3.0 -- remove radare2-5.2.1-meson_rhel8.patch - accepted upstream -- remove radare2-5.2.1-xxhash.patch - accepted upstream - -* Sat May 15 2021 Michal Ambroz 5.2.1-3 -- adding the global plugins directory - for example /usr/lib64/radare2/5.2.1 - -* Tue May 11 2021 Michal Ambroz 5.2.1-2 -- patch for older version of meson used on EPEL8 -- use pkgconfig where possible for BR -- use ldconfig_scriptlets only on older platforms -- add ExcludeArch for s390x on EPEL8 - -* Thu Apr 22 2021 Henrik Nordstrom - 5.2.1-1 -- Update to version 5.2.1 - -* Wed Apr 21 2021 Michal Ambroz 5.2.0-3 -- avoid c99 for(int i... - -* Sat Apr 17 2021 Michal Ambroz 5.2.0-2 -- fix epel build - -* Wed Apr 14 2021 Henrik Nordstrom - 5.2.0-1 -- Update to version 5.2.0 - -* Sun Feb 28 2021 Michal Ambroz 5.1.1-2 -- stop removing the r2pm binary from the package - -* Mon Feb 15 2021 Henrik Nordstrom - 5.1.1-1 -- Rebase to upstream version 5.1.1 - -* Wed Jan 27 2021 Fedora Release Engineering - 4.5.0-2.2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Fri Oct 2 2020 Riccardo Schirone - 4.5.0-2.1 -- Rebuilt to make sure version is no lower than F32 - -* Wed Jul 29 2020 Fedora Release Engineering - 4.5.0-1.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Mon Jul 20 2020 Riccardo Schirone - 4.5.0-1 -- Rebase to upstream version 4.5.0 - -* Fri May 8 2020 Riccardo Schirone - 4.4.0-2 -- Just re-build - -* Mon May 4 2020 Riccardo Schirone - 4.4.0-1 -- Rebase to upstream version 4.4.0 - -* Mon Feb 3 2020 Riccardo Schirone - 4.2.1-1 -- Rebase to upstream version 4.2.1 -- Fix CVE-2019-19647 -- Fix CVE-2019-19590 - -* Thu Jan 30 2020 Fedora Release Engineering - 3.9.0-3.2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Mon Oct 07 2019 Riccardo Schirone - 3.9.0-3.1 -- Fix epel7 build - -* Fri Oct 04 2019 Ivan Mironov - 3.9.0-2.1 -- Add missing BuildRequires: xxhash-devel, openssl-devel -- Add missing Requires for -devel package: file-devel, openssl-devel - -* Mon Sep 30 2019 Riccardo Schirone - 3.9.0-1.1 -- rebase to upstream version 3.9.0 - -* Fri Jul 26 2019 Fedora Release Engineering - 3.6.0-1.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Wed Jun 26 2019 Riccardo Schirone - 3.6.0 -- rebase to upstream version 3.6.0 -* Tue Apr 16 2019 Adam Williamson - 3.4.1-2 -- Rebuild with Meson fix for #1699099 -- Fix versioning - -* Mon Apr 8 2019 Riccardo Schirone - 3.4.1-1 -- rebase to upstream version 3.4.1 -* Tue Feb 19 2019 Riccardo Schirone - 3.3.0-2 -- rebase to upstream version 3.3.0 -* Sat Feb 02 2019 Fedora Release Engineering - 3.2.0-2.1 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Thu Jan 10 2019 Riccardo Schirone 3.2.0-2 -- fix version reported by radare2 -V -* Tue Jan 8 2019 Riccardo Schirone 3.2.0-1 -- rebase to upstream version 3.2.0 -- remove patch to disable debugger on s390x and use build option -- move doc files to common package -- fix CVE-2018-20455 CVE-2018-20456 CVE-2018-20457 CVE-2018-20458 CVE-2018-20459 CVE-2018-20460 CVE-2018-20461 -* Fri Nov 23 2018 Riccardo Schirone 3.1.0-1 -- rebase to upstream version 3.1.0 -- remove duplicated /usr/share/radare2 dir in %%files -* Tue Oct 23 2018 Riccardo Schirone 3.0.1-1 -- rebase to upstream version 3.0.1 which includes some minor fixes and fixes - for ppc64 and s390x architectures -* Tue Oct 16 2018 Riccardo Schirone 3.0.0-2 -- fix datadir dir ownership -* Tue Oct 16 2018 Riccardo Schirone 3.0.0-1 -- rebase to upstream version 3.0.0 -- fixes for r_sys_breakpoint on ppc64 and s390x architectures -* Tue Sep 4 2018 Riccardo Schirone 2.9.0-1 -- use system xxhash and openssl -- bump to 2.9.0 release -- use bcond_without to choose between release build or git one -- add gcc as BuildRequires -- do not directly call ldconfig but use RPM macros -- add patch to compile on s390x architecture (disable debugger because there is no support) -- add patch to make tags.r2 file generation reproducible -- make common subpackage do not depend on arch of main package - -* Fri Aug 3 2018 Riccardo Schirone 2.8.0-0.2.20180718git51e2936 -- add grub2 and xxhash Provides -- add some license comments -- move SDB files in -common subpackage - -* Mon Jul 16 2018 Riccardo Schirone 2.8.0-0.1.20180718git51e2936 -- bump to 2.8.0 version and switch to meson - -* Fri Apr 13 2018 Michal Ambroz 2.5.0-1 -- bump to 2.5.0 release - -* Sun Feb 11 2018 Michal Ambroz 2.4.0-1 -- bump to 2.4.0 release - -* Mon Feb 05 2018 Michal Ambroz 2.3.0-1 -- bump to 2.3.0 release -- drop the web-interface for now - -* Tue Nov 14 2017 Michal Ambroz 2.0.1-1 -- bump to 2.0.1 release - -* Fri Aug 04 2017 Michal Ambroz 1.6.0-1 -- bump to 1.6.0 release - -* Thu Jun 08 2017 Michal Ambroz 1.5.0-1 -- bump to 1.5.0 release - -* Sun Apr 23 2017 Michal Ambroz 1.4.0-1 -- bump to 1.4.0 release - -* Sat Mar 18 2017 Michal Ambroz 1.3.0-1 -- bump to 1.3.0 release - -* Sat Feb 18 2017 Michal Ambroz 1.3.0-0.1.gita37af19 -- switch to git version fixing sigseg in radiff2 - -* Wed Feb 08 2017 Michal Ambroz 1.2.1-1 -- bump to 1.2.1 -- removed deprecated post postun calling of /sbin/ldconfig - -* Sat Oct 22 2016 Michal Ambroz 0.10.6-1 -- bump to 0.10.6 - -* Sun Aug 21 2016 Michal Ambroz 0.10.5-1 -- bump to 0.10.5 - -* Mon Aug 01 2016 Michal Ambroz 0.10.4-1 -- bump to 0.10.4 - -* Sun Jun 05 2016 Michal Ambroz 0.10.3-1 -- build for Fedora for release of 0.10.3 - -* Mon Apr 25 2016 Michal Ambroz 0.10.2-1 -- build for Fedora for release of 0.10.2 - -* Thu Jan 21 2016 Michal Ambroz 0.10.0-2 -- build for Fedora for release of 0.10.0 - -* Sat Oct 10 2015 Michal Ambroz 0.10.0-1 -- build for Fedora for alpha of 0.10.0 - -* Sun Nov 09 2014 Pavel Odvody 0.9.8rc3-0 -- initial radare2 package +%autochangelog diff --git a/sources b/sources index 3e0e0e9..1fba33c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (radare2-5.6.4.tar.gz) = 5e7ff9c5d73685a4a0167750f74bb7ddcb19d3e3d2a306d8eea00b4f961efdbed4843f6e3ff66ef7108a91d372fc403eaf7343a3f4d1bada4e5ac243529e2593 +SHA512 (radare2-5.9.8.tar.gz) = d1338bcbd437c7f376a07a9d6870fa56bdab883cc5371ce506bc7f667780e19ce777c2839926d4bedf0578ec9338567b402a678643f36ac84404be55eeadb2da diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..7f0ebd0 --- /dev/null +++ b/update.sh @@ -0,0 +1,13 @@ +#!/bin/sh -e +if [ $# -lt 2 ]; then + echo "Usage: $0 dist " + exit 1 +fi +dist=${1} +shift +if [ ! -f .side-tag-$dist ]; then + echo "No existing side tag for $dist" + exit 1 +fi + +bodhi updates new --from-tag $(cat .side-tag-$dist) "$@"