mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-13 21:27:39 +02:00
Objects: Fix incorrect Bitfield maths
Turns out that #133 exposed a mistake in how we were using the end_bit field (and it should have been picked up in review, my bad). Essentially we were masking based on the length of the end_bit after *already* shifting by the start_bit. We should mask then shift, not the other way around. May well fix issue #135 (pdb generation will have been affected by this).
This commit is contained in:
@@ -367,7 +367,7 @@ class BitField(interfaces.objects.ObjectInterface, int):
|
||||
end_bit: int = 0,
|
||||
**kwargs) -> 'BitField':
|
||||
value = base_type(context = context, object_info = object_info)
|
||||
return int.__new__(cls, (value >> start_bit) & ((1 << end_bit) - 1)) # type: ignore
|
||||
return int.__new__(cls, ((value & ((1 << end_bit) - 1)) >> start_bit)) # type: ignore
|
||||
|
||||
def write(self, value):
|
||||
raise NotImplementedError("Writing to BitFields is not yet implemented")
|
||||
|
||||
Reference in New Issue
Block a user