diff --git a/src/patches/HEAD/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch b/src/patches/HEAD/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch index 7f1d08ff1..79eb1574a 100644 --- a/src/patches/HEAD/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch +++ b/src/patches/HEAD/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch @@ -1,7 +1,7 @@ -From 031d9830abe8517540389672fd22dc479e46d696 Mon Sep 17 00:00:00 2001 +From 18a58946918611ea5632ec4cab46fdc027c367ef Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Sun, 13 Feb 2022 12:59:42 -0500 -Subject: [PATCH] Small improvements to C++ decompiler testing from CLI +Subject: [PATCH 1/4] Small improvements to C++ decompiler testing from CLI * Fixes argument parsing to accept more than one option for specifying paths. @@ -129,7 +129,7 @@ index 8b762c5b1..a138f511d 100644 diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.cc -index 66f8d3fa2..c136a964b 100644 +index 6311dba06..4f7110bb4 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/testfunction.cc @@ -304,7 +304,7 @@ void FunctionTestCollection::runTests(list &lateStream) @@ -161,5 +161,5 @@ index 52125b401..46abd6bce 100644 #endif -- -2.35.1 +2.38.1 diff --git a/src/patches/HEAD/0002-Add-include-guards-to-decompiler-C-headers.patch b/src/patches/HEAD/0002-Add-include-guards-to-decompiler-C-headers.patch index 696a2e0cc..9535a5cd2 100644 --- a/src/patches/HEAD/0002-Add-include-guards-to-decompiler-C-headers.patch +++ b/src/patches/HEAD/0002-Add-include-guards-to-decompiler-C-headers.patch @@ -1,7 +1,7 @@ -From 44c439d879c18c2873d5605821132957680a4405 Mon Sep 17 00:00:00 2001 +From eebe88e987d0cbaae2b163a3697bf8669c920dc5 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Thu, 28 Jul 2022 09:20:03 -0400 -Subject: [PATCH] Add include guards to decompiler C++ headers +Subject: [PATCH 2/4] Add include guards to decompiler C++ headers --- Ghidra/Features/Decompiler/src/decompile/cpp/bfd_arch.hh | 5 +++++ @@ -133,5 +133,5 @@ index d395fb8a3..6371148b0 100644 + +#endif -- -2.37.1 +2.38.1 diff --git a/src/patches/HEAD/0003-Fix-UBSAN-errors-in-decompiler.patch b/src/patches/HEAD/0003-Fix-UBSAN-errors-in-decompiler.patch index 98a55ffe8..4d1252b73 100644 --- a/src/patches/HEAD/0003-Fix-UBSAN-errors-in-decompiler.patch +++ b/src/patches/HEAD/0003-Fix-UBSAN-errors-in-decompiler.patch @@ -1,7 +1,7 @@ -From f62b1e5483a99efe3ae6598291ec010ecee749d4 Mon Sep 17 00:00:00 2001 +From b5f27104fc965d5a7eebbfb9bbfd5a9f84039590 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Mon, 7 Feb 2022 02:02:03 +1100 -Subject: [PATCH] Fix UBSAN errors in decompiler +Subject: [PATCH 3/4] Fix UBSAN errors in decompiler --- .../Decompiler/src/decompile/cpp/address.cc | 4 ++-- @@ -20,7 +20,7 @@ Subject: [PATCH] Fix UBSAN errors in decompiler 13 files changed, 59 insertions(+), 23 deletions(-) diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc -index 1cb02c5b2..3a60d1322 100644 +index b3758ddd1..0b3bf04c8 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/address.cc @@ -685,7 +685,7 @@ uintb sign_extend(uintb in,int4 sizein,int4 sizeout) @@ -42,10 +42,10 @@ index 1cb02c5b2..3a60d1322 100644 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 0526ed04c..e79fd041e 100644 +index 19ed41c63..d1bd842d8 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/fspec.cc -@@ -2633,8 +2633,12 @@ void ProtoModelMerged::decode(Decoder &decoder) +@@ -2656,8 +2656,12 @@ void ProtoModelMerged::decode(Decoder &decoder) modellist.push_back(mymodel); } decoder.closeElement(elemId); @@ -61,7 +61,7 @@ index 0526ed04c..e79fd041e 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 e6b282ac7..f6a35728f 100644 +index 2b26961f0..117518e24 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/funcdata_varnode.cc @@ -501,7 +501,13 @@ void Funcdata::setHighLevel(void) @@ -159,7 +159,7 @@ index 49128f7e6..133da8178 100644 return res; } diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc -index b5bdb4700..ef741545c 100644 +index 9701f642b..7e8030ae8 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc @@ -974,7 +974,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data) @@ -176,7 +176,7 @@ index b5bdb4700..ef741545c 100644 consume = ~consume; if ((consume & indir->getIn(0)->getConsume())!=0) return 0; -@@ -6785,8 +6790,9 @@ int4 RulePtrsubCharConstant::applyOp(PcodeOp *op,Funcdata &data) +@@ -6788,8 +6793,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 +188,7 @@ index b5bdb4700..ef741545c 100644 Varnode *vn1 = op->getIn(1); if (!vn1->isConstant()) return 0; Varnode *outvn = op->getOut(); -@@ -7822,7 +7828,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data) +@@ -8272,7 +8278,11 @@ int4 RuleSubvarSubpiece::applyOp(PcodeOp *op,Funcdata &data) Varnode *outvn = op->getOut(); int4 flowsize = outvn->getSize(); uintb mask = calc_mask( flowsize ); @@ -202,7 +202,7 @@ index b5bdb4700..ef741545c 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 f8c1580a8..8ae5ff293 100644 +index ecebc0970..1c9ab7560 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.cc @@ -20,6 +20,7 @@ ConstTpl::ConstTpl(const_type tp) @@ -222,10 +222,10 @@ index f8c1580a8..8ae5ff293 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 dccf0437d..f7f598667 100644 +index 3b836244c..1fbd169c9 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh -@@ -46,7 +46,7 @@ private: +@@ -46,7 +46,7 @@ class ConstTpl { static void printHandleSelector(ostream &s,v_field val); static v_field readHandleSelector(const string &name); public: @@ -235,10 +235,10 @@ index dccf0437d..f7f598667 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 3ec58b9d0..55fcfd7c8 100644 +index c26cd468f..40d731480 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slgh_compile.cc -@@ -2150,8 +2150,8 @@ string SleighCompile::checkSymbols(SymbolScope *scope) +@@ -2152,8 +2152,8 @@ string SleighCompile::checkSymbols(SymbolScope *scope) ostringstream msg; SymbolTree::const_iterator iter; for(iter=scope->begin();iter!=scope->end();++iter) { @@ -249,10 +249,10 @@ index 3ec58b9d0..55fcfd7c8 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 5f4a8fe32..50bc33b8b 100644 +index dbb8f9e51..85bd54261 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghsymbol.cc -@@ -2499,7 +2499,7 @@ void ContextOp::restoreXml(const Element *el,SleighBase *trans) +@@ -2565,7 +2565,7 @@ void ContextOp::restoreXml(const Element *el,SleighBase *trans) const List &list(el->getChildren()); List::const_iterator iter; iter = list.begin(); @@ -262,10 +262,10 @@ index 5f4a8fe32..50bc33b8b 100644 } diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc -index b8dbcd55b..b2d0c1bb6 100644 +index 316074389..91bf4bc77 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/type.cc -@@ -3073,8 +3073,8 @@ void TypeFactory::recalcPointerSubmeta(Datatype *base,sub_metatype sub) +@@ -3233,8 +3233,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 +289,5 @@ index ab99382a3..67d92c573 100644 uintb true_result = ((uintb)(int32_t)f) & 0xffffffff; uintb encoding = format.getEncoding(f); -- -2.32.1 (Apple Git-133) +2.38.1 diff --git a/src/patches/HEAD/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch b/src/patches/HEAD/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch index 7235f51d5..b639d3d0d 100644 --- a/src/patches/HEAD/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch +++ b/src/patches/HEAD/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch @@ -1,14 +1,15 @@ -From 773dda85b84a03c8795e27f1df87e6024bdb208a Mon Sep 17 00:00:00 2001 +From 601242a8c9a0f13f45c2a69f2eb4516bff4b4386 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Wed, 3 Aug 2022 20:01:18 +1000 -Subject: [PATCH] Use `stroull` instead of `stroul` to parse address offsets +Subject: [PATCH 4/4] Use `stroull` instead of `stroul` to parse address + offsets --- Ghidra/Features/Decompiler/src/decompile/cpp/space.cc | 7 ++++++- 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 c51e58560..c5cc7541d 100644 +index 40a3e3bfe..ff6f282ca 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/space.cc @@ -16,6 +16,8 @@ @@ -33,5 +34,5 @@ index c51e58560..c5cc7541d 100644 enddata = (const char *) tmpdata; if (enddata - s.c_str() == s.size()) { // If no size or offset override -- -2.32.1 (Apple Git-133) +2.38.1 diff --git a/src/patches/README.md b/src/patches/README.md index e512f19e3..50685ecff 100644 --- a/src/patches/README.md +++ b/src/patches/README.md @@ -7,6 +7,10 @@ These patches primarily support packaging and testing, or fixing critical issues The two directories are detailed below: * [`stable`](./stable) --- Patches applied to the officially released _stable_ version of Ghidra. -* [`HEAD`](./HEAD) --- Patches applied to Ghidra's newer _HEAD_ commit (as listed in [`../src/setup-ghidra-source.cmake`](../src/setup-ghidra-source.cmake) file). +* [`HEAD`](./HEAD) --- Patches applied to Ghidra's newer _HEAD_ commit (as listed in [`../setup-ghidra-source.cmake`](../setup-ghidra-source.cmake) file). -See the [`../src/README.md`](../src/README.md) for more details on how these patches are used/applied. +See the [`../README.md`](../README.md) for more details on how these patches are used/applied. + +## Patch Generation + +These patches are generated from a forked Ghidra repository with a specified branching scheme and directions for generating these patches. During the event of patch conflicts, the hope is that working on those branches will make managing patches easier. diff --git a/src/patches/stable/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch b/src/patches/stable/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch index 7f1d08ff1..321495523 100644 --- a/src/patches/stable/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch +++ b/src/patches/stable/0001-Small-improvements-to-C-decompiler-testing-from-CLI.patch @@ -1,7 +1,7 @@ -From 031d9830abe8517540389672fd22dc479e46d696 Mon Sep 17 00:00:00 2001 +From 2b8a069283ac9877f8d3ffe2ee248082c3e92e7b Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Sun, 13 Feb 2022 12:59:42 -0500 -Subject: [PATCH] Small improvements to C++ decompiler testing from CLI +Subject: [PATCH 1/4] Small improvements to C++ decompiler testing from CLI * Fixes argument parsing to accept more than one option for specifying paths. @@ -161,5 +161,5 @@ index 52125b401..46abd6bce 100644 #endif -- -2.35.1 +2.38.1 diff --git a/src/patches/stable/0002-Add-include-guards-to-decompiler-C-headers.patch b/src/patches/stable/0002-Add-include-guards-to-decompiler-C-headers.patch index d6aa1c7d1..2774e316b 100644 --- a/src/patches/stable/0002-Add-include-guards-to-decompiler-C-headers.patch +++ b/src/patches/stable/0002-Add-include-guards-to-decompiler-C-headers.patch @@ -1,7 +1,7 @@ -From 143296b212e6c3c8bc8cc1e0d88511f5bbc858ff Mon Sep 17 00:00:00 2001 +From 1f655074d81731955029f4477e9da9fca66b38c1 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Thu, 28 Jul 2022 09:20:03 -0400 -Subject: [PATCH] Add include guards to decompiler C++ headers +Subject: [PATCH 2/4] Add include guards to decompiler C++ headers --- Ghidra/Features/Decompiler/src/decompile/cpp/bfd_arch.hh | 5 +++++ @@ -133,5 +133,5 @@ index 4d404e6ad..0154582b0 100644 + +#endif -- -2.37.1 +2.38.1 diff --git a/src/patches/stable/0003-Fix-UBSAN-errors-in-decompiler.patch b/src/patches/stable/0003-Fix-UBSAN-errors-in-decompiler.patch index 66304078c..6346f2dd2 100644 --- a/src/patches/stable/0003-Fix-UBSAN-errors-in-decompiler.patch +++ b/src/patches/stable/0003-Fix-UBSAN-errors-in-decompiler.patch @@ -1,7 +1,7 @@ -From 33ff58323d84c0ba57091b5bd408907a7646fd67 Mon Sep 17 00:00:00 2001 +From 3d76488739c9655c32b939d9a2cd0f8e433f65a6 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Tue, 2 Aug 2022 17:04:19 +1000 -Subject: [PATCH] Fix UBSAN errors in decompiler +Subject: [PATCH 3/4] Fix UBSAN errors in decompiler --- .../Decompiler/src/decompile/cpp/address.cc | 4 ++-- @@ -159,7 +159,7 @@ index 7927becec..4987e37ec 100644 return res; } diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc -index 2a5d92040..d65ae2918 100644 +index 2a5d92040..314863b95 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc @@ -974,7 +974,12 @@ int4 RulePullsubIndirect::applyOp(PcodeOp *op,Funcdata &data) @@ -225,7 +225,7 @@ diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh b/Ghidra/ index dccf0437d..f7f598667 100644 --- a/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh +++ b/Ghidra/Features/Decompiler/src/decompile/cpp/semantics.hh -@@ -46,7 +46,7 @@ private: +@@ -46,7 +46,7 @@ class ConstTpl { static void printHandleSelector(ostream &s,v_field val); static v_field readHandleSelector(const string &name); public: @@ -289,5 +289,5 @@ index ab99382a3..67d92c573 100644 uintb true_result = ((uintb)(int32_t)f) & 0xffffffff; uintb encoding = format.getEncoding(f); -- -2.32.1 (Apple Git-133) +2.38.1 diff --git a/src/patches/stable/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch b/src/patches/stable/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch index b2615ec8a..b2f457622 100644 --- a/src/patches/stable/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch +++ b/src/patches/stable/0004-Use-stroull-instead-of-stroul-to-parse-address-offse.patch @@ -1,7 +1,8 @@ -From b719ae7f3716b303ec0c3d8c79e7d55c7e7cbfdf Mon Sep 17 00:00:00 2001 +From e7e6917d138a483a3d50b7262865cda0ad58ed66 Mon Sep 17 00:00:00 2001 From: Alex Cameron Date: Wed, 3 Aug 2022 20:39:30 +1000 -Subject: [PATCH] Use `stroull` instead of `stroul` to parse address offsets +Subject: [PATCH 4/4] Use `stroull` instead of `stroul` to parse address + offsets --- Ghidra/Features/Decompiler/src/decompile/cpp/space.cc | 7 ++++++- @@ -33,5 +34,5 @@ index 5f07edf8e..b86c9beae 100644 enddata = (const char *) tmpdata; if (enddata - s.c_str() == s.size()) { // If no size or offset override -- -2.32.1 (Apple Git-133) +2.38.1