Skip to content

Commit

Permalink
Merge pull request #63 from Decompollaborate/develop
Browse files Browse the repository at this point in the history
1.11.0
  • Loading branch information
AngheloAlf authored May 22, 2024
2 parents adc30b6 + 7b51c84 commit 34ecb56
Show file tree
Hide file tree
Showing 13 changed files with 149 additions and 37 deletions.
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.11.0] - 2024-05-22

### Added

- New global configuration:
- `misc_expandJalr`: If `True` then `jalr` instructions will be always emitted
with two operands. Otherwise the `rd` register will be omitted if it is
`$ra` and will be used explicitly if it isn't `$ra`. Defaults to `False`.

### Fixed

- Fix crash in Rust bindings for to Rust 1.78.
- This happens because `slice.get_unchecked` now performs OoB checks in debug
builds, which is is triggered when trying to dereference unsized C arrays.
- Fix heap corruption in Rust bindings (#62)
- The C API was returning string sizes without accounting for the null
terminator, which produced issues on the Rust size which was not manually
including it.

## [1.10.0] - 2024-04-22

### Added
Expand Down Expand Up @@ -566,8 +585,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [1.0.0] - 2022-07-07

### Uncategorized

### Added

- New classes:
Expand Down Expand Up @@ -601,6 +618,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- First version

[unreleased]: https://github.com/Decompollaborate/rabbitizer/compare/master...develop
[1.11.0]: https://github.com/Decompollaborate/rabbitizer/compare/1.10.0...1.11.0
[1.10.0]: https://github.com/Decompollaborate/rabbitizer/compare/1.9.5...1.10.0
[1.9.5]: https://github.com/Decompollaborate/rabbitizer/compare/1.9.4...1.9.5
[1.9.4]: https://github.com/Decompollaborate/rabbitizer/compare/1.9.3...1.9.4
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[package]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.10.0"
version = "1.11.0"
edition = "2021"
authors = ["Anghelo Carvajal <[email protected]>"]
description = "MIPS instruction decoder"
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@ MIPS instruction decoder API.
doesn't allocate in anything in the heap by itself.
- Other language bindings supported in this repo:
- Python bindings
- The minimal Python version is 3.7, older versions are not guaranteed to work.
- The minimal Python version is 3.7, older versions are not guaranteed to
work.
- C++ bindings
- Rust bindings
- Simple per-word instruction decoding.
- The library doesn't try to be too smart by processing multiple instructions
at a time.
at a time.
- Can perform validation checks for instructions.
- Provides many examination/grouping functions for instructions, allowing to
simplify checking characteristics of an instruction and minimizing the need to
check for specific instructions in a hardcoded way.
- Includes some minor tools to build your own pointer/symbol detection.
- Configurable, many features can be turned on and off.
- MIPS instructions features:
- Configurable behavior for the `jalr` instruction, allowing to disassemble
that instruction using an implicit or explicit `rd` register depending if
that register is `$ra` or not.
- Named registers for MIPS VR4300's coprocessors.
- Support for many pseudo-instructions.
- Properly handle move to/from coprocessor instructions.
Expand Down Expand Up @@ -65,7 +69,7 @@ If you use a `requirements.txt` file in your repository, then you can add this
library with the following line:

```txt
rabbitizer>=1.10.0,<2.0.0
rabbitizer>=1.11.0,<2.0.0
```

### Development version
Expand Down Expand Up @@ -105,7 +109,7 @@ cargo add rabbitizer
Or you can add it manually to your `Cargo.toml`:

```toml
rabbitizer = "1.10.0"
rabbitizer = "1.11.0"
```

See this crate at <https://crates.io/crates/rabbitizer>.
Expand Down
1 change: 1 addition & 0 deletions include/common/RabbitizerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ typedef struct RabbitizerConfig_Misc {
bool unknownInstrComment; // Generate a pseudo-disassembly comment when disassembling non implemented instructions
bool omit0XOnSmallImm;
bool upperCaseImm;
bool expandJalr;
} RabbitizerConfig_Misc;

typedef struct RabbitizerConfig {
Expand Down
2 changes: 1 addition & 1 deletion include/common/RabbitizerVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern "C" {

// Header version
#define RAB_VERSION_MAJOR 1
#define RAB_VERSION_MINOR 10
#define RAB_VERSION_MINOR 11
#define RAB_VERSION_PATCH 0

#define RAB_VERSION_STR RAB_STRINGIFY(RAB_VERSION_MAJOR) "." RAB_STRINGIFY(RAB_VERSION_MINOR) "." RAB_STRINGIFY(RAB_VERSION_PATCH)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[project]
name = "rabbitizer"
# Version should be synced with include/common/RabbitizerVersion.h
version = "1.10.0"
version = "1.11.0"
description = "MIPS instruction decoder"
# license = "MIT"
readme = "README.md"
Expand Down
1 change: 1 addition & 0 deletions rabbitizer/Config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ class _RabbitizerConfig:
misc_unknownInstrComment: bool = True
misc_omit0XOnSmallImm: bool = False
misc_upperCaseImm: bool = True
misc_expandJalr: bool = False

config: _RabbitizerConfig
2 changes: 2 additions & 0 deletions rabbitizer/rabbitizer_global_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ DEF_MEMBER_GET_SET_INT(misc, opcodeLJust, false, 0, 0)
DEF_MEMBER_GET_SET_BOOL(misc, unknownInstrComment)
DEF_MEMBER_GET_SET_BOOL(misc, omit0XOnSmallImm)
DEF_MEMBER_GET_SET_BOOL(misc, upperCaseImm)
DEF_MEMBER_GET_SET_BOOL(misc, expandJalr)


static PyGetSetDef rabbitizer_global_config_GetSets[] = {
Expand Down Expand Up @@ -155,6 +156,7 @@ static PyGetSetDef rabbitizer_global_config_GetSets[] = {
MEMBER_GET_SET(misc, unknownInstrComment, "", NULL),
MEMBER_GET_SET(misc, omit0XOnSmallImm, "", NULL),
MEMBER_GET_SET(misc, upperCaseImm, "", NULL),
MEMBER_GET_SET(misc, expandJalr, "", NULL),

{ 0 },
};
Expand Down
2 changes: 1 addition & 1 deletion rust/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ impl Instruction {
let buffer_size =
RabbitizerInstruction_getSizeForBuffer(self, imm_override_len, extra_l_just);

let mut buffer: Vec<u8> = vec![0; buffer_size];
let mut buffer: Vec<u8> = vec![0; buffer_size + 1];
let disassembled_size = RabbitizerInstruction_disassemble(
self,
buffer.as_mut_ptr() as *mut core::ffi::c_char,
Expand Down
2 changes: 1 addition & 1 deletion rust/src/opereand_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl operand_type_enum::OperandType {
unsafe {
let buffer_size = RabbitizerOperandType_getBufferSize(*self, instr, imm_override_len);

let mut buffer: Vec<u8> = vec![0; buffer_size];
let mut buffer: Vec<u8> = vec![0; buffer_size + 1];
let disassembled_size = RabbitizerOperandType_disassemble(
*self,
instr,
Expand Down
Loading

0 comments on commit 34ecb56

Please sign in to comment.