Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable v0.6.0 #325

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .builds/freebsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ environment:
CC: clang
HOST_CC: clang
sources:
- https://github.com/rizinorg/rizin#stable
- https://github.com/rizinorg/rizin
- https://github.com/rizinorg/rz-ghidra
- https://github.com/rizinorg/rizin-testbins
hottub_trigger: '.*'
Expand Down
2 changes: 1 addition & 1 deletion .builds/openbsd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:
CXX: clang++
CC: clang
sources:
- https://github.com/rizinorg/rizin#stable
- https://github.com/rizinorg/rizin
- https://github.com/rizinorg/rz-ghidra
- https://github.com/rizinorg/rizin-testbins
hottub_trigger: '.*'
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ jobs:
with:
repository: rizinorg/rizin
path: rizin
ref: stable
- name: Extract rizin version
shell: pwsh
run: echo "branch=$(python sys/version.py)" >> $Env:GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
pip install meson
- name: Prepare Rizin and Cutter
run: |
git clone --recursive --depth 1 -b stable https://github.com/rizinorg/rizin
git clone --recursive --depth 1 https://github.com/rizinorg/rizin
cd rizin
meson build
ninja -C build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ ghidra/flex/
.ccls-cache
.gdb_history
.cache/
.DS_Store
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ env:

install:
- pip3 install meson
- git clone --depth 1 -b stable https://github.com/rizinorg/rizin
- git clone --depth 1 https://github.com/rizinorg/rizin
- cd rizin && mkdir build && cd build
- meson --prefix="$INSTALL_PREFIX" ..
- ninja
Expand Down
2 changes: 1 addition & 1 deletion scripts/Dockerfile.arch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN pacman --noconfirm -Syu
RUN pacman --noconfirm -S git gcc make cmake pkg-config flex bison meson ninja qt5-base qt5-svg qt5-tools

RUN cd /root && \
git clone --depth 1 -b stable https://github.com/rizinorg/rizin && \
git clone --depth 1 https://github.com/rizinorg/rizin && \
cd rizin && \
meson build --prefix=/usr && \
ninja -C build && \
Expand Down
2 changes: 1 addition & 1 deletion scripts/Dockerfile.buster
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get -y install git g++ cmake pkg-config flex bison python3 python3-pip n
pip3 install meson

RUN cd /root && \
git clone --depth 1 -b stable https://github.com/rizinorg/rizin && \
git clone --depth 1 https://github.com/rizinorg/rizin && \
cd rizin && \
meson build --prefix=/usr && \
ninja -C build && \
Expand Down
4 changes: 2 additions & 2 deletions src/CodeXMLParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct ParseCodeXMLContext
static char *strdup_rz(const char *s)
{
size_t sz = strlen(s);
char *r = reinterpret_cast<char *>(rz_malloc(sz + 1));
char *r = reinterpret_cast<char *>(rz_mem_alloc(sz + 1));
if(!r)
return NULL;
memcpy(r, s, sz + 1);
Expand Down Expand Up @@ -350,7 +350,7 @@ RZ_API RzAnnotatedCode *ParseCodeXML(Funcdata *func, const char *xml)
ParseNode(doc.child("function"), &ctx, ss, code);

std::string str = ss.str();
code->code = reinterpret_cast<char *>(rz_malloc(str.length() + 1));
code->code = reinterpret_cast<char *>(rz_mem_alloc(str.length() + 1));
if(!code->code)
{
rz_annotated_code_free(code);
Expand Down
3 changes: 2 additions & 1 deletion src/RizinScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ FunctionSymbol *RizinScope::registerFunction(RzAnalysisFunction *fcn) const
auto flag = reinterpret_cast<RzFlagItem *>(pos);
if(flag->space && flag->space->name && !strcmp(flag->space->name, RZ_FLAGS_FS_SECTIONS))
continue;
if (flag->realname && *flag->realname) {
if(!strcmp(flag->name, fcn->name) && flag->realname && *flag->realname)
{
fcn_name = flag->realname;
break;
}
Expand Down
4 changes: 1 addition & 3 deletions src/analysis_ghidra.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2937,9 +2937,7 @@ static bool esil_peek_n(RzAnalysisEsil *esil, int bits)
ut64 bitmask = genmask(bits - 1);
ut8 a[sizeof(ut64)] = {0};
ret = !!rz_analysis_esil_mem_read(esil, addr, a, bytes);
ut64 b = rz_read_ble64(a, 0); // esil->analysis->big_endian);
if(esil->analysis->big_endian)
rz_mem_swapendian((ut8 *)&b, (const ut8 *)&b, bytes);
ut64 b = rz_read_ble64(a, esil->analysis->big_endian);

snprintf(res, sizeof(res), "0x%" PFMT64x, b & bitmask);
rz_analysis_esil_push(esil, res);
Expand Down
46 changes: 23 additions & 23 deletions test/db/extras/analysis_ghidra
Original file line number Diff line number Diff line change
Expand Up @@ -83,91 +83,91 @@ e asm.bits
wx 89e1
pdq 1
ao | grep type
?e ----
echo ----
wx a168a00408
pdq 1
ao | grep type
?e ----
echo ----
wx a368a00408
pdq 1
ao | grep type
?e ----
echo ----
wx 8945f0
pdq 1
ao | grep type
?e ----
echo ----
wx 8b4510
pdq 1
ao | grep type
?e ----
echo ----
wx 0f4c0d03000000
pdq 1
ao | grep type
?e ----
echo ----
wx cd80
pdq 1
ao | grep type
?e ----
echo ----
wx 55
pdq 1
ao | grep type
?e ----
echo ----
wx 6a00
pdq 1
ao | grep type
?e ----
echo ----
wx 5d
pdq 1
ao | grep type
?e ----
echo ----
wx 83f853
pdq 1
ao | grep type
?e ----
echo ----
wx 85c0
pdq 1
ao | grep type
?e ----
echo ----
wx 83c410
pdq 1
ao | grep type
?e ----
echo ----
wx 81ec88100000
pdq 1
ao | grep type
?e ----
echo ----
wx f7ea
pdq 1
ao | grep type
?e ----
echo ----
wx f7f2
pdq 1
ao | grep type
?e ----
echo ----
wx d1e8
pdq 1
ao | grep type
?e ----
echo ----
wx d1e0
pdq 1
ao | grep type
?e ----
echo ----
wx d1f8
pdq 1
ao | grep type
?e ----
echo ----
wx 0b25f0ff0000
pdq 1
ao | grep type
?e ----
echo ----
wx 2325f0ff0000
pdq 1
ao | grep type
?e ----
echo ----
wx 3325f0ff0000
pdq 1
ao | grep type
?e ----
echo ----
wx 8703
pdq 1
ao | grep type
Expand All @@ -189,7 +189,7 @@ e asm.arch=ghidra
wx 298947f9
pdq 1
ao | grep type
?e ----
echo ----
wx 690200f9 @ 0x200
pdq 1 @ 0x200
ao @ 0x200| grep type
Expand Down
63 changes: 47 additions & 16 deletions test/db/extras/ghidra
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ s sym.get_global_array_entry
af
e ghidra.rawptr=1
pdg
?e --
echo --
e ghidra.rawptr=0
pdg
EOF
Expand Down Expand Up @@ -275,7 +275,7 @@ s sym.get_global_var
af
e ghidra.rawptr=1
pdg
?e --
echo --
e ghidra.rawptr=0
pdg
EOF
Expand Down Expand Up @@ -315,15 +315,15 @@ s sym.get_global_var
af
e ghidra.rawptr=1
pdg
?e --
echo --
e ghidra.rawptr=0
pdg
?e --
echo --
s sym.get_global_array_entry
af
e ghidra.rawptr=1
pdg
?e --
echo --
e ghidra.rawptr=0
pdg
EOF
Expand Down Expand Up @@ -2277,12 +2277,12 @@ afvs 4 bright BrightPtr
afvs 8 argc "Bright *"
afvs 12 argv "const char **"
pdg
?e --
echo --
afvs 4 bright "BrightTypedefd *"
afvs 8 argc int32_t
afvs 12 argv "const char **"
pdg
?e --
echo --
afvs 4 bright BrightTypedefdPtr
pdg
EOF
Expand Down Expand Up @@ -2740,18 +2740,18 @@ s main
af
e scr.color=0
pdg
?e --
echo --
pdgo
?e --
echo --
pdg*
?e --
echo --
pdgx~!id=,<addr
?e --
echo --
pdgd~!id=,protectedMode
?e --
echo --
e scr.color=3
pdg
?e --
echo --
pdgo
EOF
RUN
Expand Down Expand Up @@ -3076,7 +3076,7 @@ EOF
CMDS=<<EOF
s main
pi 8
?e -----
echo -----
pdgsd 8~!STORE
EOF
RUN
Expand Down Expand Up @@ -3254,10 +3254,10 @@ FILE=rizin-testbins/mach0/hello-macos-arm64
CMDS=<<EOF
aaa
s main
?e ------------ with propagation
echo ------------ with propagation
e ghidra.ropropagate
pdg
?e ------------ without propagation
echo ------------ without propagation
e ghidra.ropropagate=0
pdg
EOF
Expand Down Expand Up @@ -3350,3 +3350,34 @@ undefined4 sym.ko_example_init(void)
}
EOF
RUN

NAME=realname and multiple flags at function
FILE=rizin-testbins/mach0/hello-macos-arm64-objc-stubs-stripped
CMDS=<<EOF
e asm.flags.real=1
aaa
pdg @ 0x100003ae8
EOF
EXPECT=<<EOF

// WARNING: Variable defined which should be unmapped: var_10h
// WARNING: [rz-ghidra] Detected overlap for variable var_28h
// WARNING: [rz-ghidra] Detected overlap for variable var_2ch

void method.Test.methodWithTwoArgs:secondArg:(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4)
{
int32_t var_2ch;
int64_t var_24h;
int64_t var_18h;
int64_t var_10h;

var_2ch = (int32_t)arg4;
if (var_2ch < (int32_t)arg3) {
var_2ch = (int32_t)arg3;
}
*(int32_t *)(arg1 + 8) = var_2ch;
NSLog(__CFConstantStringClassReference);
return;
}
EOF
RUN
Loading