ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

Exception thrown at Structure Editor when inserting size > 1.000.000.000

Open wichiandyx opened this issue 1 year ago • 13 comments

Describe the bug Exception thrown at Structure Editor when inserting variable that has big size ( > 1.000.000.000 ) image I've got a case where i need to figure out the variables been used at this, so i'm thinking of using Structure Editor to visualize it better To Reproduce Steps to reproduce the behavior:

  1. Go to 'Structure Editor'
  2. Set the size to > 1000000000 or set char[1000000000]
  3. It will throw error like shown below image

Expected behavior If possible, Structure Editor to support a very big structure.

Screenshots I've already included the screenshot above.

Environment (please complete the following information):

  • OS: Windows 10
  • Java Version: 17.0.4.1
  • Ghidra Version: 10.3 (Build DEV 07-April-2023)
  • Ghidra Origin: [Official Github]

wichiandyx avatar Apr 14 '23 19:04 wichiandyx

🤔 I think 1000000000 is a bit too large for a bitfield.

I can't reproduce the error, but it definitely doesn't behave as expected.

astrelsky avatar Apr 14 '23 22:04 astrelsky

🤔 I think 1000000000 is a bit too large for a bitfield.

I can't reproduce the error, but it definitely doesn't behave as expected.

hi astrelsky :D it doesnt throw exception at all? did you used the latest commit?

wichiandyx avatar Apr 15 '23 07:04 wichiandyx

It doesn't throw an exception at all. It just doesn't behave correctly.

astrelsky avatar Apr 15 '23 18:04 astrelsky

Hi @astrelsky ! :D Very weird, i've also tried to compile the latest one (Build DEV 16-April-2023), but it still throws the same exception @.@

wichiandyx avatar Apr 16 '23 12:04 wichiandyx

I've reproduced the exception

ryanmkurtz avatar Apr 17 '23 10:04 ryanmkurtz

I've reproduced the exception

I must have immunity somehow. All I see is the editor stop rendering structure components and when I try to close ghidra it gives me the warning about changes or something.

astrelsky avatar Apr 17 '23 11:04 astrelsky

I got the exception when converting a byte to an array via the popup where you enter the size.

ryanmkurtz avatar Apr 17 '23 11:04 ryanmkurtz

I hope ghidra could support a big structure, so it could help me with some edge case (like this one) 😄

wichiandyx avatar Apr 17 '23 17:04 wichiandyx

The composite implementation and associated editor are not designed to scale to this number of components and certainly does not perform well when a very large number of components exist within a composite. We may have to limit the maximum size of a composite as a number of 1-byte components to avoid unintended use such as this.

ghidra1 avatar Apr 17 '23 17:04 ghidra1

The composite implementation and associated editor are not designed to scale to this number of components and certainly does not perform well when a very large number of components exist within a composite. We may have to limit the maximum size of a composite as a number of 1-byte components to avoid unintended use such as this.

ah i see, i just wanted to visualize the usage of this big char array in global (as I saw this array been used as a substitute for multiple variant structs, quite evil indeed), it's just hard to keep track of it as is, maybe i should look for workaround 😵

wichiandyx avatar Apr 17 '23 17:04 wichiandyx

In addition to the composite performance, the BitFieldEditorPanel and BitFieldPlacementComponent need to be refactored to adopt some additional scaling to handle extremely large structures. In the absence of scaling, limits would need to be imposed which would prevent rendering and use of this bit-level view to avoid errors and unexpected behavior.

ghidra1 avatar May 23 '23 20:05 ghidra1

This may be fixed by commit 02b0dfe which will soon be pushed.

ghidra1 avatar Jul 29 '24 20:07 ghidra1

Sorry, apparently it is not fixed by this latest change.

ghidra1 avatar Jul 31 '24 13:07 ghidra1