-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix floating point test and allow positive or negative NAN
Apple Silicon mac reports positive NAN instead of negative NAN, so allow both using a regex
- Loading branch information
Showing
13 changed files
with
91 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 76289be82722d1a076bb9718507ce57748b40543 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Mon, 12 Aug 2024 12:02:35 -0400 | ||
Subject: [PATCH 1/5] Fix UBSAN errors in decompiler | ||
Subject: [PATCH 1/6] Fix UBSAN errors in decompiler | ||
|
||
Co-authored-by: Alex Cameron <[email protected]> | ||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
src/patches/HEAD/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 2e4706231191395dac90b764ce29c55de29ca2ce Mon Sep 17 00:00:00 2001 | ||
From: Alex Cameron <[email protected]> | ||
Date: Wed, 3 Aug 2022 20:01:18 +1000 | ||
Subject: [PATCH 2/5] Use `stroull` instead of `stroul` to parse address | ||
Subject: [PATCH 2/6] Use `stroull` instead of `stroul` to parse address | ||
offsets | ||
|
||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
src/patches/HEAD/0003-Add-missing-index-check-to-prevent-errors-in-Windows.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 26a110b55617237c910447b576752fa0acb6a146 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Sat, 30 Mar 2024 18:46:16 -0400 | ||
Subject: [PATCH 3/5] Add missing index check to prevent errors in Windows | ||
Subject: [PATCH 3/6] Add missing index check to prevent errors in Windows | ||
|
||
Not sure why this only appears when testing on Windows. | ||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
src/patches/HEAD/0004-Use-string-resize-instead-of-reserve.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From d7f7be313580a6e0eef101848a3c86e3a3db4029 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Tue, 29 Oct 2024 15:30:57 -0400 | ||
Subject: [PATCH 4/5] Use string resize instead of reserve | ||
Subject: [PATCH 4/6] Use string resize instead of reserve | ||
|
||
assign will fix up the size to hold all of what's copied | ||
--- | ||
|
2 changes: 1 addition & 1 deletion
2
src/patches/HEAD/0005-Ignore-floating-point-test-due-to-compilation-differ.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From a76b69021f34973973487362cb5f25f7644880b8 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Tue, 29 Oct 2024 17:51:09 -0400 | ||
Subject: [PATCH 5/5] Ignore floating point test due to compilation differences | ||
Subject: [PATCH 5/6] Ignore floating point test due to compilation differences | ||
|
||
This test fails on macOS and Windows. I'm unsure whether it's an OS or | ||
compiler issue. | ||
|
37 changes: 37 additions & 0 deletions
37
src/patches/HEAD/0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
From ce0148e9dd6d4a9ba92ee44fb50be1f01b7a8858 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Wed, 30 Oct 2024 14:26:57 -0400 | ||
Subject: [PATCH 6/6] Allow positive or negative NAN in decompiler floating | ||
point test | ||
|
||
At least on Apple Silicon, this test reports positive NAN. | ||
|
||
Use the regex optional operator '?' to allow for positive or negative | ||
NAN. | ||
--- | ||
.../Decompiler/src/decompile/datatests/floatprint.xml | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml b/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml | ||
index f8108d3d32..1060a3e193 100644 | ||
--- a/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml | ||
+++ b/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml | ||
@@ -58,13 +58,13 @@ bbbdd7d9df7cdb3d000000000000f03f | ||
<stringmatch name="Float print #3" min="1" max="1">floatv3 = -0.001;</stringmatch> | ||
<stringmatch name="Float print #4" min="1" max="1">floatv4 = 1e-06;</stringmatch> | ||
<stringmatch name="Float print #5" min="1" max="1">floatv5 = INFINITY;</stringmatch> | ||
-<stringmatch name="Float print #6" min="1" max="1">floatv6 = -NAN;</stringmatch> | ||
+<stringmatch name="Float print #6" min="1" max="1">floatv6 = -?NAN;</stringmatch> | ||
<stringmatch name="Float print #7" min="1" max="1">floatv7 = 3.141592e-06;</stringmatch> | ||
<stringmatch name="Float print #8" min="1" max="1">double1 = 0.6666666666666666;</stringmatch> | ||
<stringmatch name="Float print #9" min="1" max="1">double2 = 2.0;</stringmatch> | ||
<stringmatch name="Float print #10" min="1" max="1">double3 = -0.001;</stringmatch> | ||
<stringmatch name="Float print #11" min="1" max="1">double4 = 1e-10;</stringmatch> | ||
<stringmatch name="Float print #12" min="1" max="1">double5 = INFINITY;</stringmatch> | ||
-<stringmatch name="Float print #13" min="1" max="1">double6 = -NAN;</stringmatch> | ||
+<stringmatch name="Float print #13" min="1" max="1">double6 = -?NAN;</stringmatch> | ||
<stringmatch name="Float print #14" min="1" max="1">double7 = 3.1415926535897933e-06;</stringmatch> | ||
</decompilertest> | ||
-- | ||
2.47.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From c5a494bcd940fb46ffe90164c5ec0b61d897a892 Mon Sep 17 00:00:00 2001 | ||
From d3de474854d052712217ad731fffcea6334808ff Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Mon, 12 Aug 2024 12:02:35 -0400 | ||
Subject: [PATCH 1/5] Fix UBSAN errors in decompiler | ||
Subject: [PATCH 1/6] Fix UBSAN errors in decompiler | ||
|
||
Co-authored-by: Alex Cameron <[email protected]> | ||
--- | ||
|
4 changes: 2 additions & 2 deletions
4
src/patches/stable/0002-Use-stroull-instead-of-stroul-to-parse-address-offse.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 60b1bb423c10b2e53ad72e7b84ac647e56282aca Mon Sep 17 00:00:00 2001 | ||
From 4bbcb71e2c2cf1362628917c26879bbcb4717665 Mon Sep 17 00:00:00 2001 | ||
From: Alex Cameron <[email protected]> | ||
Date: Wed, 3 Aug 2022 20:01:18 +1000 | ||
Subject: [PATCH 2/5] Use `stroull` instead of `stroul` to parse address | ||
Subject: [PATCH 2/6] Use `stroull` instead of `stroul` to parse address | ||
offsets | ||
|
||
--- | ||
|
4 changes: 2 additions & 2 deletions
4
src/patches/stable/0003-Add-missing-index-check-to-prevent-errors-in-Windows.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From e853cd1dc018c0f8a76f936de0391bbdf467a907 Mon Sep 17 00:00:00 2001 | ||
From 31c3e037e8104e9060b73c62bb5895a8665efbcb Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Sat, 30 Mar 2024 18:46:16 -0400 | ||
Subject: [PATCH 3/5] Add missing index check to prevent errors in Windows | ||
Subject: [PATCH 3/6] Add missing index check to prevent errors in Windows | ||
|
||
Not sure why this only appears when testing on Windows. | ||
--- | ||
|
4 changes: 2 additions & 2 deletions
4
src/patches/stable/0004-Use-string-resize-instead-of-reserve.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From ddd126b14277841a885e824047908fb360e26191 Mon Sep 17 00:00:00 2001 | ||
From 7eb62bb534ac02b723baad0bb0a9cb7d33813972 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Tue, 29 Oct 2024 15:30:57 -0400 | ||
Subject: [PATCH 4/5] Use string resize instead of reserve | ||
Subject: [PATCH 4/6] Use string resize instead of reserve | ||
|
||
assign will fix up the size to hold all of what's copied | ||
--- | ||
|
4 changes: 2 additions & 2 deletions
4
src/patches/stable/0005-Ignore-floating-point-test-due-to-compilation-differ.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 163be34210f69068f89e20acf89a4fbd50a88b76 Mon Sep 17 00:00:00 2001 | ||
From 9b118da968eac4a5ad910dc51d7d70150bab0408 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Tue, 29 Oct 2024 17:51:09 -0400 | ||
Subject: [PATCH 5/5] Ignore floating point test due to compilation differences | ||
Subject: [PATCH 5/6] Ignore floating point test due to compilation differences | ||
|
||
This test fails on macOS and Windows. I'm unsure whether it's an OS or | ||
compiler issue. | ||
|
37 changes: 37 additions & 0 deletions
37
src/patches/stable/0006-Allow-positive-or-negative-NAN-in-decompiler-floatin.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
From f130a89a600a210e12e4505a4533d27ea7b7e4f7 Mon Sep 17 00:00:00 2001 | ||
From: Eric Kilmer <[email protected]> | ||
Date: Wed, 30 Oct 2024 14:26:57 -0400 | ||
Subject: [PATCH 6/6] Allow positive or negative NAN in decompiler floating | ||
point test | ||
|
||
At least on Apple Silicon, this test reports positive NAN. | ||
|
||
Use the regex optional operator '?' to allow for positive or negative | ||
NAN. | ||
--- | ||
.../Decompiler/src/decompile/datatests/floatprint.xml | 4 ++-- | ||
1 file changed, 2 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml b/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml | ||
index f8108d3d32..1060a3e193 100644 | ||
--- a/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml | ||
+++ b/Ghidra/Features/Decompiler/src/decompile/datatests/floatprint.xml | ||
@@ -58,13 +58,13 @@ bbbdd7d9df7cdb3d000000000000f03f | ||
<stringmatch name="Float print #3" min="1" max="1">floatv3 = -0.001;</stringmatch> | ||
<stringmatch name="Float print #4" min="1" max="1">floatv4 = 1e-06;</stringmatch> | ||
<stringmatch name="Float print #5" min="1" max="1">floatv5 = INFINITY;</stringmatch> | ||
-<stringmatch name="Float print #6" min="1" max="1">floatv6 = -NAN;</stringmatch> | ||
+<stringmatch name="Float print #6" min="1" max="1">floatv6 = -?NAN;</stringmatch> | ||
<stringmatch name="Float print #7" min="1" max="1">floatv7 = 3.141592e-06;</stringmatch> | ||
<stringmatch name="Float print #8" min="1" max="1">double1 = 0.6666666666666666;</stringmatch> | ||
<stringmatch name="Float print #9" min="1" max="1">double2 = 2.0;</stringmatch> | ||
<stringmatch name="Float print #10" min="1" max="1">double3 = -0.001;</stringmatch> | ||
<stringmatch name="Float print #11" min="1" max="1">double4 = 1e-10;</stringmatch> | ||
<stringmatch name="Float print #12" min="1" max="1">double5 = INFINITY;</stringmatch> | ||
-<stringmatch name="Float print #13" min="1" max="1">double6 = -NAN;</stringmatch> | ||
+<stringmatch name="Float print #13" min="1" max="1">double6 = -?NAN;</stringmatch> | ||
<stringmatch name="Float print #14" min="1" max="1">double7 = 3.1415926535897933e-06;</stringmatch> | ||
</decompilertest> | ||
-- | ||
2.47.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters