mirror of
https://github.com/lifting-bits/sleigh
synced 2026-06-21 13:56:12 +00:00
Compare commits
28 Commits
v10.3
..
will/nixify
| Author | SHA1 | Date | |
|---|---|---|---|
| c711ddce7b | |||
| 5b76dd9ed5 | |||
| 0f40864cec | |||
| 7ea4feb70e | |||
| daa95e1d6b | |||
| da1b36dfb7 | |||
| 393adb711e | |||
| fb4dec76cb | |||
| 331f4cc2b7 | |||
| 0d84e6ffb5 | |||
| f84470ac10 | |||
| 04d1204eb5 | |||
| 1c5fad6a6b | |||
| 459824f983 | |||
| ea5986827e | |||
| 393ed42fc6 | |||
| 57e6d7c79d | |||
| 8c5b8049a6 | |||
| 7b1232ec99 | |||
| f9a4905c31 | |||
| ff5929e1fc | |||
| 844e5e07fe | |||
| 51bd95f360 | |||
| f63b99a700 | |||
| f1d1eab45f | |||
| 83ae3b5dfe | |||
| 548b28c67d | |||
| f23739ee3f |
@@ -25,7 +25,7 @@ jobs:
|
||||
release: [stable, HEAD]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Git User for Applying Patches
|
||||
# See this thread for more details https://github.community/t/github-actions-bot-email-address/17204/5
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
|
||||
# Need this to run further Actions on the newly created PR
|
||||
# See here for more details https://github.com/peter-evans/create-pull-request/blob/28fa4848947e0faa7fa50647691d01477589d5e9/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens
|
||||
- uses: tibdex/github-app-token@v1
|
||||
- uses: tibdex/github-app-token@v2
|
||||
if: steps.head_update.outputs.did_update
|
||||
id: generate-token
|
||||
with:
|
||||
|
||||
@@ -4,3 +4,5 @@ build
|
||||
# FetchContent Ghidra source directories
|
||||
/src/ghidra*
|
||||
cmake_fc_*
|
||||
|
||||
.direnv/
|
||||
|
||||
Generated
+95
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681202837,
|
||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1682291304,
|
||||
"narHash": "sha256-VkufTQNEclnZ0HnSXxmXC2Qvtj6/3/8SyZfRyL4AllI=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b2d51541a37678ad4e870f75326b6e68daf3b3c7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1680945546,
|
||||
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d9f759f2ea8d265d974a6e1259bd510ac5844c5d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681486253,
|
||||
"narHash": "sha256-EjiQZvXQH9tUPCyLC6lQpfGnoq4+kI9v59bDJWPicYo=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "b25d1a3c2c7554d0462ab1dfddf2f13128638b90",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
};
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
treefmt-nix,
|
||||
}:
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
ghidra = with final;
|
||||
applyPatches {
|
||||
src = fetchFromGitHub {
|
||||
owner = "NationalSecurityAgency";
|
||||
repo = "ghidra";
|
||||
rev = "refs/tags/Ghidra_10.3.3_build";
|
||||
sha256 = "sha256-KDSiZ/JwAqX6Obg9UD8ZQut01l/eMXbioJy//GluXn0=";
|
||||
};
|
||||
patches = [
|
||||
./src/patches/stable/0001-Fix-UBSAN-errors-in-decompiler.patch
|
||||
./src/patches/stable/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch
|
||||
];
|
||||
};
|
||||
|
||||
sleigh = with final;
|
||||
stdenv.mkDerivation {
|
||||
name = "sleigh";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
ninja
|
||||
git
|
||||
];
|
||||
buildInputs = [
|
||||
ghidra
|
||||
];
|
||||
cmakeFlags = [
|
||||
"-DFETCHCONTENT_SOURCE_DIR_GHIDRASOURCE=${ghidra}"
|
||||
];
|
||||
};
|
||||
sleigh-debug = with final;
|
||||
final.sleigh.overrideAttrs (o: {
|
||||
dontStrip = true;
|
||||
enableDebugging = true;
|
||||
separateDebugInfo = true;
|
||||
});
|
||||
sleigh-asan = with final;
|
||||
final.sleigh-debug.overrideAttrs (o: {
|
||||
cmakeFlags = o.cmakeFlags ++ ["-DCMAKE_C_FLAGS=-fsanitize=address" "-DCMAKE_CXX_FLAGS=-fsanitize=address"];
|
||||
});
|
||||
};
|
||||
}
|
||||
// flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [self.overlays.default];
|
||||
};
|
||||
in {
|
||||
packages.default = pkgs.sleigh;
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
sleigh-asan
|
||||
clang-tools
|
||||
];
|
||||
};
|
||||
formatter = treefmt-nix.lib.mkWrapper pkgs {
|
||||
projectRootFile = ".git/config";
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
clang-format.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
From 098585db4fa8c8eb9184851a40ef6706f1d176ed Mon Sep 17 00:00:00 2001
|
||||
From 67ac779382508ab0d5ff10bcb0a8453068cce5a2 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Cameron <asc@tetsuo.sh>
|
||||
Date: Mon, 7 Feb 2022 02:02:03 +1100
|
||||
Subject: [PATCH 1/3] Fix UBSAN errors in decompiler
|
||||
Date: Mon, 5 Jun 2023 16:45:04 +1200
|
||||
Subject: [PATCH 1/2] Fix UBSAN errors in decompiler
|
||||
|
||||
---
|
||||
.../Decompiler/src/decompile/cpp/address.cc | 4 ++--
|
||||
.../Decompiler/src/decompile/cpp/fspec.cc | 8 ++++++--
|
||||
.../src/decompile/cpp/funcdata_varnode.cc | 8 +++++++-
|
||||
.../Decompiler/src/decompile/cpp/op.cc | 6 +++++-
|
||||
@@ -17,32 +16,10 @@ Subject: [PATCH 1/3] Fix UBSAN errors in decompiler
|
||||
.../Decompiler/src/decompile/cpp/slghsymbol.cc | 2 +-
|
||||
.../Decompiler/src/decompile/cpp/type.cc | 2 +-
|
||||
.../src/decompile/unittests/testfloatemu.cc | 2 +-
|
||||
13 files changed, 59 insertions(+), 23 deletions(-)
|
||||
12 files changed, 57 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
|
||||
index 2eb08b96a..07bf3ba55 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
|
||||
@@ -687,7 +687,7 @@ uintb sign_extend(uintb in,int4 sizein,int4 sizeout)
|
||||
void sign_extend(intb &val,int4 bit)
|
||||
|
||||
{
|
||||
- intb mask = 0;
|
||||
+ uintb mask = 0;
|
||||
mask = (~mask)<<bit;
|
||||
if (((val>>bit)&1)!=0)
|
||||
val |= mask;
|
||||
@@ -701,7 +701,7 @@ void sign_extend(intb &val,int4 bit)
|
||||
void zero_extend(intb &val,int4 bit)
|
||||
|
||||
{
|
||||
- intb mask = 0;
|
||||
+ uintb mask = 0;
|
||||
mask = (~mask)<<bit;
|
||||
mask <<= 1;
|
||||
val &= (~mask);
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
|
||||
index 1402bbd80..4b271e055 100644
|
||||
index 82771cc04..da78c8071 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
|
||||
@@ -2661,8 +2661,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
|
||||
@@ -97,16 +74,16 @@ index 0e3decc80..403ec35a7 100644
|
||||
break;
|
||||
case CPUI_INT_MULT:
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
|
||||
index fcd75cc7d..6da2a2a7c 100644
|
||||
index aebcfd910..6c47e6eb1 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
|
||||
@@ -750,7 +750,13 @@ uintb OpBehaviorPiece::evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb i
|
||||
@@ -746,7 +746,13 @@ uintb OpBehaviorPiece::evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb i
|
||||
uintb OpBehaviorSubpiece::evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb in2) const
|
||||
|
||||
{
|
||||
- uintb res = (in1>>(in2*8)) & calc_mask(sizeout);
|
||||
+ uintb res = in1;
|
||||
+ if ((in2*8) < sizeof(in1)) {
|
||||
+ if (in2 < sizeof(in1)) {
|
||||
+ res >>= (in2*8);
|
||||
+ } else {
|
||||
+ res = 0;
|
||||
@@ -159,7 +136,7 @@ index ca9d71ab9..85d4dd281 100644
|
||||
return res;
|
||||
}
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
|
||||
index f11ab8dea..66a0b32fc 100644
|
||||
index ae2e502c1..a22b8ebdc 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
|
||||
@@ -976,7 +976,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data)
|
||||
@@ -176,7 +153,7 @@ index f11ab8dea..66a0b32fc 100644
|
||||
consume = ~consume;
|
||||
if ((consume & indir->getIn(0)->getConsume())!=0) return 0;
|
||||
|
||||
@@ -6778,8 +6783,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
|
||||
@@ -6789,8 +6794,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
|
||||
Varnode *sb = op->getIn(0);
|
||||
Datatype *sbType = sb->getTypeReadFacing(op);
|
||||
if (sbType->getMetatype() != TYPE_PTR) return 0;
|
||||
@@ -188,7 +165,7 @@ index f11ab8dea..66a0b32fc 100644
|
||||
Varnode *vn1 = op->getIn(1);
|
||||
if (!vn1->isConstant()) return 0;
|
||||
Varnode *outvn = op->getOut();
|
||||
@@ -8509,7 +8515,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data)
|
||||
@@ -8600,7 +8606,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data)
|
||||
Varnode *outvn = op->getOut();
|
||||
int4 flowsize = outvn->getSize();
|
||||
uintb mask = calc_mask( flowsize );
|
||||
@@ -225,7 +202,7 @@ diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh b/Ghidra/
|
||||
index 8e283dca0..652600c16 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
|
||||
@@ -48,7 +48,7 @@ class ConstTpl {
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
static void printHandleSelector(ostream &s,v_field val);
|
||||
static v_field readHandleSelector(const string &name);
|
||||
public:
|
||||
@@ -262,10 +239,10 @@ index b308e1b71..af2982aee 100644
|
||||
}
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
|
||||
index f1c0b6452..68de180fc 100644
|
||||
index 32ede6b0f..238d97f40 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
|
||||
@@ -3296,8 +3296,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub)
|
||||
@@ -3384,8 +3384,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub)
|
||||
top.submeta = sub; // Search on the incorrect submeta
|
||||
iter = tree.lower_bound(&top);
|
||||
while(iter != tree.end()) {
|
||||
@@ -289,5 +266,5 @@ index c35bde877..061e53677 100644
|
||||
uintb true_result = ((uintb)(int32_t)f) & 0xffffffff;
|
||||
uintb encoding = format.getEncoding(f);
|
||||
--
|
||||
2.40.0
|
||||
2.39.2 (Apple Git-143)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From a2d412ce5edb750ee1f768a4a7ebfeaece6f7976 Mon Sep 17 00:00:00 2001
|
||||
From 9fd26cd754b6f83e45199db896fd0fcea23cd59d Mon Sep 17 00:00:00 2001
|
||||
From: Alex Cameron <asc@tetsuo.sh>
|
||||
Date: Wed, 3 Aug 2022 20:01:18 +1000
|
||||
Subject: [PATCH 2/3] Use `stroull` instead of `stroul` to parse address
|
||||
Subject: [PATCH 2/2] Use `stroull` instead of `stroul` to parse address
|
||||
offsets
|
||||
|
||||
---
|
||||
@@ -34,5 +34,5 @@ index bf4e1dc96..594b4583a 100644
|
||||
enddata = (const char *) tmpdata;
|
||||
if (enddata - s.c_str() == s.size()) { // If no size or offset override
|
||||
--
|
||||
2.40.0
|
||||
2.39.2 (Apple Git-143)
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
From 098585db4fa8c8eb9184851a40ef6706f1d176ed Mon Sep 17 00:00:00 2001
|
||||
From: Alex Cameron <asc@tetsuo.sh>
|
||||
Date: Mon, 7 Feb 2022 02:02:03 +1100
|
||||
Subject: [PATCH 1/3] Fix UBSAN errors in decompiler
|
||||
From 0e437cb96249306d17f26ff6614871ecd9b37359 Mon Sep 17 00:00:00 2001
|
||||
From: "github-actions[bot]"
|
||||
<41898282+github-actions[bot]@users.noreply.github.com>
|
||||
Date: Wed, 2 Aug 2023 23:19:42 +1000
|
||||
Subject: [PATCH 1/2] Fix UBSAN errors in decompiler
|
||||
|
||||
---
|
||||
.../Decompiler/src/decompile/cpp/address.cc | 4 ++--
|
||||
.../Decompiler/src/decompile/cpp/fspec.cc | 8 ++++++--
|
||||
.../src/decompile/cpp/funcdata_varnode.cc | 8 +++++++-
|
||||
.../Decompiler/src/decompile/cpp/op.cc | 6 +++++-
|
||||
@@ -17,32 +17,10 @@ Subject: [PATCH 1/3] Fix UBSAN errors in decompiler
|
||||
.../Decompiler/src/decompile/cpp/slghsymbol.cc | 2 +-
|
||||
.../Decompiler/src/decompile/cpp/type.cc | 2 +-
|
||||
.../src/decompile/unittests/testfloatemu.cc | 2 +-
|
||||
13 files changed, 59 insertions(+), 23 deletions(-)
|
||||
12 files changed, 57 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
|
||||
index 2eb08b96a..07bf3ba55 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc
|
||||
@@ -687,7 +687,7 @@ uintb sign_extend(uintb in,int4 sizein,int4 sizeout)
|
||||
void sign_extend(intb &val,int4 bit)
|
||||
|
||||
{
|
||||
- intb mask = 0;
|
||||
+ uintb mask = 0;
|
||||
mask = (~mask)<<bit;
|
||||
if (((val>>bit)&1)!=0)
|
||||
val |= mask;
|
||||
@@ -701,7 +701,7 @@ void sign_extend(intb &val,int4 bit)
|
||||
void zero_extend(intb &val,int4 bit)
|
||||
|
||||
{
|
||||
- intb mask = 0;
|
||||
+ uintb mask = 0;
|
||||
mask = (~mask)<<bit;
|
||||
mask <<= 1;
|
||||
val &= (~mask);
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
|
||||
index 1402bbd80..4b271e055 100644
|
||||
index 8380d3cd..a18d5007 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc
|
||||
@@ -2661,8 +2661,12 @@ void ProtoModelMerged::decode(Decoder &decoder)
|
||||
@@ -61,7 +39,7 @@ index 1402bbd80..4b271e055 100644
|
||||
|
||||
void ParameterBasic::setTypeLock(bool val)
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
|
||||
index f77817073..283d81c31 100644
|
||||
index f7781707..283d81c3 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc
|
||||
@@ -503,7 +503,13 @@ void Funcdata::setHighLevel(void)
|
||||
@@ -80,7 +58,7 @@ index f77817073..283d81c31 100644
|
||||
uint4 vnFlags = vn->getFlags() & (Varnode::directwrite|Varnode::addrforce);
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
|
||||
index 0e3decc80..403ec35a7 100644
|
||||
index 0e3decc8..403ec35a 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/op.cc
|
||||
@@ -672,7 +672,11 @@ uintb PcodeOp::getNZMaskLocal(bool cliploop) const
|
||||
@@ -97,7 +75,7 @@ index 0e3decc80..403ec35a7 100644
|
||||
break;
|
||||
case CPUI_INT_MULT:
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
|
||||
index fcd75cc7d..6da2a2a7c 100644
|
||||
index fcd75cc7..ed0e005a 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/opbehavior.cc
|
||||
@@ -750,7 +750,13 @@ uintb OpBehaviorPiece::evaluateBinary(int4 sizeout,int4 sizein,uintb in1,uintb i
|
||||
@@ -106,7 +84,7 @@ index fcd75cc7d..6da2a2a7c 100644
|
||||
{
|
||||
- uintb res = (in1>>(in2*8)) & calc_mask(sizeout);
|
||||
+ uintb res = in1;
|
||||
+ if ((in2*8) < sizeof(in1)) {
|
||||
+ if (in2 < sizeof(in1)) {
|
||||
+ res >>= (in2*8);
|
||||
+ } else {
|
||||
+ res = 0;
|
||||
@@ -116,7 +94,7 @@ index fcd75cc7d..6da2a2a7c 100644
|
||||
}
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc
|
||||
index ca9d71ab9..85d4dd281 100644
|
||||
index ca9d71ab..85d4dd28 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/pcodecompile.cc
|
||||
@@ -621,8 +621,10 @@ vector<OpTpl *> *PcodeCompile::assignBitRange(VarnodeTpl *vn,uint4 bitoffset,uin
|
||||
@@ -159,7 +137,7 @@ index ca9d71ab9..85d4dd281 100644
|
||||
return res;
|
||||
}
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
|
||||
index f11ab8dea..66a0b32fc 100644
|
||||
index 4851365d..d069d1c9 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
|
||||
@@ -976,7 +976,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data)
|
||||
@@ -176,7 +154,7 @@ index f11ab8dea..66a0b32fc 100644
|
||||
consume = ~consume;
|
||||
if ((consume & indir->getIn(0)->getConsume())!=0) return 0;
|
||||
|
||||
@@ -6778,8 +6783,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
|
||||
@@ -6782,8 +6787,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data)
|
||||
Varnode *sb = op->getIn(0);
|
||||
Datatype *sbType = sb->getTypeReadFacing(op);
|
||||
if (sbType->getMetatype() != TYPE_PTR) return 0;
|
||||
@@ -188,7 +166,7 @@ index f11ab8dea..66a0b32fc 100644
|
||||
Varnode *vn1 = op->getIn(1);
|
||||
if (!vn1->isConstant()) return 0;
|
||||
Varnode *outvn = op->getOut();
|
||||
@@ -8509,7 +8515,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data)
|
||||
@@ -8593,7 +8599,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data)
|
||||
Varnode *outvn = op->getOut();
|
||||
int4 flowsize = outvn->getSize();
|
||||
uintb mask = calc_mask( flowsize );
|
||||
@@ -202,7 +180,7 @@ index f11ab8dea..66a0b32fc 100644
|
||||
if (!aggressive) {
|
||||
if ((vn->getConsume() & mask) != vn->getConsume()) return 0;
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc
|
||||
index 2e3531ea2..42482be7c 100644
|
||||
index 2e3531ea..42482be7 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc
|
||||
@@ -22,6 +22,7 @@ ConstTpl::ConstTpl(const_type tp)
|
||||
@@ -222,10 +200,10 @@ index 2e3531ea2..42482be7c 100644
|
||||
|
||||
bool ConstTpl::isConstSpace(void) const
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
|
||||
index 8e283dca0..652600c16 100644
|
||||
index 8e283dca..652600c1 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh
|
||||
@@ -48,7 +48,7 @@ class ConstTpl {
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
static void printHandleSelector(ostream &s,v_field val);
|
||||
static v_field readHandleSelector(const string &name);
|
||||
public:
|
||||
@@ -235,7 +213,7 @@ index 8e283dca0..652600c16 100644
|
||||
type=op2.type; value=op2.value; value_real=op2.value_real; select=op2.select; }
|
||||
ConstTpl(const_type tp,uintb val);
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
|
||||
index b40f74389..3c37958df 100644
|
||||
index b40f7438..3c37958d 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc
|
||||
@@ -2163,8 +2163,8 @@ string SleighCompile::checkSymbols(SymbolScope *scope)
|
||||
@@ -249,7 +227,7 @@ index b40f74389..3c37958df 100644
|
||||
msg << " Label <" << sym->getName() << "> was placed but not used" << endl;
|
||||
else if (!sym->isPlaced())
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
|
||||
index b308e1b71..af2982aee 100644
|
||||
index b308e1b7..af2982ae 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc
|
||||
@@ -2569,7 +2569,7 @@ void ContextOp::restoreXml(const Element *el,SleighBase *trans)
|
||||
@@ -262,10 +240,10 @@ index b308e1b71..af2982aee 100644
|
||||
}
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
|
||||
index f1c0b6452..68de180fc 100644
|
||||
index 30faf0b6..e76a0619 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc
|
||||
@@ -3296,8 +3296,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub)
|
||||
@@ -3359,8 +3359,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub)
|
||||
top.submeta = sub; // Search on the incorrect submeta
|
||||
iter = tree.lower_bound(&top);
|
||||
while(iter != tree.end()) {
|
||||
@@ -276,7 +254,7 @@ index f1c0b6452..68de180fc 100644
|
||||
++iter;
|
||||
if (ptr->submeta == sub) {
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc b/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc
|
||||
index c35bde877..061e53677 100644
|
||||
index c35bde87..061e5367 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/unittests/testfloatemu.cc
|
||||
@@ -346,7 +346,7 @@ TEST(float_opTrunc_to_int) {
|
||||
@@ -289,5 +267,5 @@ index c35bde877..061e53677 100644
|
||||
uintb true_result = ((uintb)(int32_t)f) & 0xffffffff;
|
||||
uintb encoding = format.getEncoding(f);
|
||||
--
|
||||
2.40.0
|
||||
2.39.2 (Apple Git-143)
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
From a2d412ce5edb750ee1f768a4a7ebfeaece6f7976 Mon Sep 17 00:00:00 2001
|
||||
From: Alex Cameron <asc@tetsuo.sh>
|
||||
Date: Wed, 3 Aug 2022 20:01:18 +1000
|
||||
Subject: [PATCH 2/3] Use `stroull` instead of `stroul` to parse address
|
||||
From 95f230f46bdb95aa4aab7f5d320691f87107fb36 Mon Sep 17 00:00:00 2001
|
||||
From: "github-actions[bot]"
|
||||
<41898282+github-actions[bot]@users.noreply.github.com>
|
||||
Date: Wed, 2 Aug 2023 23:20:14 +1000
|
||||
Subject: [PATCH 2/2] Use `stroull` instead of `stroul` to parse address
|
||||
offsets
|
||||
|
||||
---
|
||||
@@ -9,7 +10,7 @@ Subject: [PATCH 2/3] Use `stroull` instead of `stroul` to parse address
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
|
||||
index bf4e1dc96..594b4583a 100644
|
||||
index bf4e1dc9..594b4583 100644
|
||||
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
|
||||
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc
|
||||
@@ -16,6 +16,8 @@
|
||||
@@ -34,5 +35,5 @@ index bf4e1dc96..594b4583a 100644
|
||||
enddata = (const char *) tmpdata;
|
||||
if (enddata - s.c_str() == s.size()) { // If no size or offset override
|
||||
--
|
||||
2.40.0
|
||||
2.39.2 (Apple Git-143)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ set_property(CACHE sleigh_RELEASE_TYPE PROPERTY STRINGS "stable" "HEAD")
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
# Ghidra pinned stable version commit
|
||||
set(ghidra_version "10.3")
|
||||
set(ghidra_version "10.3.3")
|
||||
set(ghidra_git_tag "Ghidra_${ghidra_version}_build")
|
||||
set(ghidra_shallow TRUE)
|
||||
|
||||
@@ -46,9 +46,9 @@ set(ghidra_patches
|
||||
if("${sleigh_RELEASE_TYPE}" STREQUAL "HEAD")
|
||||
# TODO: Try to remember to look at Ghidra/application.properties
|
||||
# TODO: CMake only likes numeric characters in the version string....
|
||||
set(ghidra_head_version "10.4")
|
||||
set(ghidra_head_version "10.5")
|
||||
set(ghidra_version "${ghidra_head_version}")
|
||||
set(ghidra_head_git_tag "3e9419d4d793dad0619e51769474be61d6968ef9")
|
||||
set(ghidra_head_git_tag "4561e8335d3b62329c4afdf5a91bc6ce113b7002")
|
||||
set(ghidra_git_tag "${ghidra_head_git_tag}")
|
||||
set(ghidra_shallow FALSE)
|
||||
set(ghidra_patches
|
||||
|
||||
Reference in New Issue
Block a user