diff --git a/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html b/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html index 493a267476..b342fc582e 100644 --- a/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html +++ b/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html @@ -22,6 +22,56 @@
++Improvements
++
+- Debugger:LLDB. Upgraded SWIG-generated Java (plus docs) to LLVM/lldb 16.x. (GP-3442, Issue #5359)
+- Decompiler. Added an option to the Decompiler, controlling the maximum size of jumptable that can be recovered. (GP-3266)
+- Decompiler. Improved Decompiler function call-override to consider calling convention when differentiating function signatures. (GP-3268, Issue #5335)
+- Decompiler. The Decompiler now respects tool options for shortening template strings within symbol names. (GP-3369)
+- Importer:ELF. Added Max Zero-Segment Discard Size import option to ELF Loader. Value was previously hard-coded to 255 bytes. (GP-3428, Issue #5273)
+- Importer:Mach-O. Restored Mach-O indirect symbol creation when binding information is not present, such as when importing a DYLIB extracted from a dyld_shared_cache. (GP-3526)
+- Languages. Added windows__stdcall calling convention as an alias to the default calling convention for aarch64 and x86-64. (GP-3472)
+- Scripting. Improved the RecoverClassesFromRTTIScript recognition of special vtables when they are in memory blocks not tied to imported file bytes. (GP-3463)
+- Scripting. Mitigated a RecoverClassesFromRTTIScript issue where mangled typeinfo names were not always getting extracted from memory when more than one bad data type was created over the memory containing the mangled string. (GP-3467)
+
+Bugs
++
+- Analysis. Fixed regression when functions are set as inline that can cause lockups: during analysis, with use of stack depth field, and for Set Stack Depth Change action. (GP-3499, Issue #5378, #5400, #5401)
+- CParser. Fixed C header file parsing of pragma lines when a comma is found outside of parentheses. (GP-3541, Issue #5427)
+- Data Types. Corrected issues related to data organization retention and upgrade for data types. (GP-3506)
+- Debugger:GDB. Reduced frenetic queries for module info at launch time. Fixed 00000000 values in module ranges. (GP-3448, Issue #4456, #5357)
+- Decompiler. Fixed bug that could cause errors in constant calculations involving 128-bit or larger registers. (GP-3426, Issue #3492)
+- Decompiler. Fixed a bug that could prevent recovery of a switch if the variable is written indirectly through a pointer alias. (GP-3441, Issue #5307)
+- Decompiler. Corrected 10.3 regression when Edit Function Signature is invoked from Decompiler, which may ignore the calling convention used with current function decompilation. (GP-3454, Issue #5367)
+- Decompiler. Fixed hashing bug causing inconsistent results with Force Field action in the Decompiler. (GP-3508, Issue #5372)
+- Documentation. Fixed missing return in termmines.c exercise file. (GP-3444, Issue #5343)
+- Exporter. Fixed a regression in the Original File exporter that prevented it from working when unapplied relocations were present in the relocation table. (GP-3446, Issue #5346)
+- GUI. Fixed bug where Ghidra did not prompt to save GUI Theme changes when exiting via a menu versus the window X (Close Window) button. (GP-3477, Issue #5377)
+- GUI. Updated the Python Interpreter prompt to use less space. (GP-3509, Issue #5379)
+- GUI. Fixed issue with menu bar colors on Mac system when using Mac Aqua Look and Feel while in dark mode. (GP-3528, Issue #4454)
+- Importer. Fixed an exception that occurred when the MzLoader tried to split the HEADER overlay block. (GP-3447, Issue #5320)
+- Importer:ELF. Corrected potential exception when processing invalid ELF PT_NOTE program header. (GP-3493, Issue #5384)
+- Importer:ELF. Corrected bugs in ELF Android packed relocation processing and rendering of sleb128 data type. (GP-3543)
+- Importer:Mach-O. Fixed a regression in the Mach-O Loader that was causing incorrect DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE fixups. (GP-3474)
+- Importer:Mach-O. Fixed an AddressOutOfBoundsException that could sometimes occur when importing the exports section of dyld_shared_cache files. (GP-3505, Issue #5392)
+- Importer:PE. Fixed an IllegalStateException that could occur if both Load Local Libraries From Disk and Load System Libraries From Disk options are used during import and the same library is found in both local and system directories. (GP-3445)
+- Importer:PE. Fixed a bug that caused PE symbol .exports files to always get deleted after import. (GP-3519, Issue #5348)
+- Languages. Adjusted handling of PowerPC e500 small data area pointer. (GP-3480)
+- Processors. Fixed operand count mismatch in some M68000 instructions. (GP-2779, Issue #4807, #4808)
+- Processors. Corrected issue with M68000 pea instruction with address based on SP. (GP-2955, Issue #4795)
+- Processors. Fixed flag issue in 6502 TSX instruction. (GP-2963, Issue #4838)
+- Processors. Addressed multiple issues with 8048, including fixing the movp, movp3, and jmpp instructions and correcting the implementation of the memory bank selection. (GP-3009, Issue #2423, #4825)
+- Processors. Fixed decoding of x86-64 popf and pushf instructions. (GP-3102, Issue #4980)
+- Processors. Corrected pcode for PowerPC e_stmvsprw instruction. (GP-3325, Issue #4886)
+- Processors. Fixed PowerPC instruction eieio decode for all valid variants. (GP-3432, Issue #4887)
+- Processors. Fixed issue with AARCH64 mla instruction using erroneous registers. (GP-3478)
+- Processors. Restored original M68000 calling convention to only use stack, and added an additional .cspec file for the optional Register ABI calling convention for ColdFire. Also added bonus function start patterns identified during testing. (GP-3532, Issue #5390)
+- Sleigh. Fixed SleighEditor to allow 2 to n arguments in CPOOL Sleigh operator. (GP-3534, Issue #2148)
+
New Features
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfRelocationTable.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfRelocationTable.java index d73df8d949..97e8e42e76 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfRelocationTable.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/elf/ElfRelocationTable.java @@ -197,11 +197,11 @@ public class ElfRelocationTable implements ElfFileSection { int relocationIndex = 0; long remainingRelocations = reader.readNext(LEB128::signed); // reloc_count long offset = reader.readNext(LEB128::signed); // reloc_baseOffset + long addend = 0; while (remainingRelocations > 0) { - // start new group - long addend = 0; + // start new group - read group header (size and flags) // group_size long groupSize = reader.readNext(LEB128::signed); @@ -228,10 +228,13 @@ public class ElfRelocationTable implements ElfFileSection { // group_info (optional) long groupRInfo = groupedByInfo ? reader.readNext(LEB128::signed) : 0; - if (groupedByAddend && groupHasAddend) { + if (groupHasAddend && groupedByAddend) { // group_addend (optional) addend += reader.readNext(LEB128::signed); } + else if (!groupHasAddend) { + addend = 0; + } for (int i = 0; i < groupSize; i++) { // reloc_offset (optional) diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/AbstractLeb128DataType.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/AbstractLeb128DataType.java index a70f9b2045..cfc671ed88 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/AbstractLeb128DataType.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/data/AbstractLeb128DataType.java @@ -21,7 +21,6 @@ import java.io.InputStream; import ghidra.docking.settings.*; import ghidra.program.model.mem.MemBuffer; import ghidra.program.model.scalar.Scalar; -import ghidra.util.classfinder.ClassTranslator; /** * An abstract base class for a LEB128 variable length integer data type. @@ -82,13 +81,27 @@ public abstract class AbstractLeb128DataType extends BuiltIn implements Dynamic maxLength = LEB128.MAX_SUPPORTED_LENGTH; } + int len = getLength(buf, maxLength); + if (len < 1) { + return null; // error, or more than 10 bytes long + } + + long val; try (InputStream is = buf.getInputStream(0, maxLength)) { - long val = LEB128.read(is, signed); - return new Scalar(64 - Long.numberOfLeadingZeros(val), val, signed); + val = LEB128.read(is, signed); } catch (IOException e) { - return null; // memory error, or more than 10 bytes long + return null; // error, or more than 10 bytes long } + + // approximate bitLength from storage byte length + int bitLength = Math.max(64, len * 7); + int mod = bitLength % 8; + if (mod != 0) { + bitLength += (8 - mod); + } + + return new Scalar(bitLength, val, signed); } @Override diff --git a/Ghidra/Processors/68000/data/patterns/68000_patterns.xml b/Ghidra/Processors/68000/data/patterns/68000_patterns.xml index 6a271ccd39..6d381ac744 100644 --- a/Ghidra/Processors/68000/data/patterns/68000_patterns.xml +++ b/Ghidra/Processors/68000/data/patterns/68000_patterns.xml @@ -16,6 +16,7 @@ 0x4e 0x56 1111.... .......0 0101...1 10001111 01001000 11010111 ........ ........ 0010...0 0.101111 0000.... .......0 + 0x48 0xe7 ........ ........ 0x2f 0x02 0x2f 0x03 0x2f 0x0a