From 3c34eecca172d19b178caedc4dc8c9266ed77662 Mon Sep 17 00:00:00 2001 From: jmlagor <73651947+jmlagor@users.noreply.github.com> Date: Tue, 23 Mar 2021 11:36:23 -0400 Subject: [PATCH 1/2] GP-796 Fixing broken tests in ResourceDataTypesTest, ControlFlowGuardTest and PE_ResourceTest --- .../bin/format/pe/ImageRuntimeFunctionEntries.java | 12 ++++++------ .../{pe => }/cli/streams/CliStreamStringsTest.java | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) rename Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/{pe => }/cli/streams/CliStreamStringsTest.java (98%) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java index 7a372d9d19..32c5e38bbb 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -155,8 +155,8 @@ public class ImageRuntimeFunctionEntries { unwindInfo.version = (byte) (splitByte & UNWIND_INFO_VERSION_BITMASK); unwindInfo.flags = (byte) (splitByte >> UNWIND_INFO_FLAGS_SHIFT); - unwindInfo.sizeOfProlog = reader.readNextByte(); - unwindInfo.countOfUnwindCodes = reader.readNextByte(); + unwindInfo.sizeOfProlog = reader.readNextUnsignedByte(); + unwindInfo.countOfUnwindCodes = reader.readNextUnsignedByte(); splitByte = reader.readNextByte(); unwindInfo.frameRegister = (byte) (splitByte & UNWIND_INFO_FRAME_REGISTER_MASK); @@ -307,8 +307,8 @@ public class ImageRuntimeFunctionEntries { byte version; byte flags; - byte sizeOfProlog; - byte countOfUnwindCodes; + int sizeOfProlog; + int countOfUnwindCodes; byte frameRegister; byte frameOffset; UNWIND_CODE[] unwindCodes; diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/pe/cli/streams/CliStreamStringsTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java similarity index 98% rename from Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/pe/cli/streams/CliStreamStringsTest.java rename to Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java index 4f418ccff1..e03b12b508 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/pe/cli/streams/CliStreamStringsTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java @@ -4,16 +4,16 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.app.util.bin.format.pe.cli.streams; +package ghidra.app.util.bin.format.cli.streams; import static org.junit.Assert.*; @@ -26,6 +26,7 @@ import generic.test.AbstractGTest; import ghidra.app.util.bin.BinaryReader; import ghidra.app.util.bin.ByteArrayProvider; import ghidra.app.util.bin.format.pe.cli.CliStreamHeader; +import ghidra.app.util.bin.format.pe.cli.streams.CliStreamStrings; import ghidra.util.LittleEndianDataConverter; public class CliStreamStringsTest extends AbstractGTest { From 93408f424ce76c75e431291a79d8c9e754251b60 Mon Sep 17 00:00:00 2001 From: jmlagor <73651947+jmlagor@users.noreply.github.com> Date: Tue, 23 Mar 2021 12:06:23 -0400 Subject: [PATCH 2/2] GP-796 Certified --- .../app/util/bin/format/pe/ImageRuntimeFunctionEntries.java | 4 ++-- .../app/util/bin/format/cli/streams/CliStreamStringsTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java index 32c5e38bbb..f03e7b91db 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/pe/ImageRuntimeFunctionEntries.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java index e03b12b508..90f717f8d9 100644 --- a/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java +++ b/Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/cli/streams/CliStreamStringsTest.java @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.