ghidra icon indicating copy to clipboard operation
ghidra copied to clipboard

DataTypeComponent.getLength - bits or bytes?

Open Cazra opened this issue 9 months ago • 3 comments

Is DataTypeComponent's getLength() method supposed to return the length of the component in bits or bytes? I cannot find this documented anywhere.

Cazra avatar May 10 '24 14:05 Cazra

It is odd that the docs do not specify this. Taken from ghidra.program.model.data.DataType:

Get the length of this DataType as a number of 8-bit bytes.

dragonmacher avatar May 10 '24 15:05 dragonmacher

Taken from ghidra.program.model.data.DataType:

Get the length of this DataType as a number of 8-bit bytes.

That would answer the question if DataTypeComponent were indeed a DataType, but unfortunately it is not. So, the semantics of DataTypeComponent.getLength are still uncertain. 🫤

Cazra avatar May 10 '24 18:05 Cazra

I verified that the way DataTypeComponent's length is set using, in some cases, the data type's length. This signaled that it is indeed byte-based.

dragonmacher avatar May 10 '24 20:05 dragonmacher