binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

Force type to selection size when using highlight-bytes set type

Open herrcore opened this issue 1 year ago • 1 comments

What is the feature you'd like to have? When using the highlight bytes -> type workflow to set a type for a specific range of bytes the type will greedily add more than just the highlighted bytes to the type.

This is specifically an issue for UTF-16 strings that are not null terminated. When attempting to set the type for these strings additional non-string bytes are added to the string. There may be other use-cases for this but non-null-terminated UTF-16 strings are common culprits.

Is your feature request related to a problem? No, there is a perfectly acceptable work around of editing the type after creating it but this is very annoying for more than a few strings.

Are any alternative solutions acceptable? Yes but it is annoying. Currently the alternative solution is...

  • Highlight string bytes, shift-A
  • Type gobbles up extra bytes 🤦‍♂️
  • Y - Change type, adjust size to correct type

Additional Information: Current version: 4.0.4858-dev

Screenshot 2024-02-13 at 8 30 02 PM Screenshot 2024-02-13 at 8 30 11 PM

herrcore avatar Feb 14 '24 01:02 herrcore

Another alternate solution is to highlight the bytes, and use * to create an array with element type wchar16

negasora avatar Feb 15 '24 21:02 negasora

another work around. Hit make your selection. Then hit 2 to create 2 byte elements then hit *.

The current behavior is very important as it allows you to select a large range of null terminated strings and convert them all at once. I think the provided workaround is sufficient.

plafosse avatar Mar 05 '24 14:03 plafosse