Skip to content

Convert ZydisDecoder field decoder_mode to a bitmap. #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

jpidancet
Copy link
Contributor

Make decoder_mode a bitmap instead of an array of booleans for space efficiency.

Copy link
Member

@flobernd flobernd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change, but it seems like some stuff needs to be fixed before merging 🙂

The regression tests are failing and the fuzzer complains as well.

Make decoder_mode a bitmap instead of an array of booleans for space
efficiency.
@jpidancet jpidancet force-pushed the decoder-mode-bitmap branch from 2e27d4b to 261f0ee Compare April 19, 2023 07:41
@jpidancet
Copy link
Contributor Author

Hi,

Thank you for having a look. It looks like the || vs | mix-up was causing all the build and fuzzing errors. It is fixed now.

@jpidancet jpidancet requested a review from flobernd April 19, 2023 08:01
@flobernd
Copy link
Member

flobernd commented Apr 19, 2023

@jpidancet Thanks for fixing! I will merge if @athre0z agrees as well.

@athre0z @th0rex fyi, this is a breaking change for the JS, Rust, etc. bindings 🙂

For v5 I would like to change the public API for this entirely (ZydisDecoderEnableMode(mode) -> ZydisDecoderSetModes(bitmask) and converting the ZYDIS_DECODER_MODE_X constants to bits), but for now it's probably better to keep the current API.

@athre0z
Copy link
Member

athre0z commented Apr 19, 2023

For v5 I would like to change the public API for this entirely (ZydisDecoderEnableMode(mode) -> ZydisDecoderSetModes(bitmask) and converting the ZYDIS_DECODER_MODE_X constants to bits), but for now it's probably better to keep the current API.

We can do this in a non-breaking manner by just adding such a function without removing the old one. I think this would be preferable here since maintaining the old function is very little effort. We can mark the old function as deprecated and remove it in a few years, or just keep it around forever. Changing the constants is not API breaking, only ABI breaking, so can be done in a minor version.

Copy link
Member

@athre0z athre0z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good change!

@athre0z athre0z merged commit 6d820cc into zyantific:master Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants