Open iaoing opened 1 year ago
In Python, the result of int/int is the float type and the size is as same as the float in C/C++. However, the int type in Python is unbounded. Thus, conversion from floating point to integer may round or truncate as in C.
int/int
Calculating of cache line aligned address: https://github.com/cosmoss-jigu/witcher/blob/ad69038cdcd4ac20f1bde38ebf7e6d9fd6999b36/replay/mem/cachenumbers.py#L8-L9
calculating of atomic-size aligned address: https://github.com/cosmoss-jigu/witcher/blob/ad69038cdcd4ac20f1bde38ebf7e6d9fd6999b36/replay/mem/witchertrace.py#L43-L44
If the address starts with 0xf, the result is incorrect after the calculation.
0xf
aligned_addr = address // ALIGNMENT_NUM * ALIGNMENT_NUM
Issue:
In Python, the result of
int/int
is the float type and the size is as same as the float in C/C++. However, the int type in Python is unbounded. Thus, conversion from floating point to integer may round or truncate as in C.Affected code:
Calculating of cache line aligned address: https://github.com/cosmoss-jigu/witcher/blob/ad69038cdcd4ac20f1bde38ebf7e6d9fd6999b36/replay/mem/cachenumbers.py#L8-L9
calculating of atomic-size aligned address: https://github.com/cosmoss-jigu/witcher/blob/ad69038cdcd4ac20f1bde38ebf7e6d9fd6999b36/replay/mem/witchertrace.py#L43-L44
If the address starts with
0xf
, the result is incorrect after the calculation.Fixes: