GraphEngine
GraphEngine copied to clipboard
Fix(MemoryTrunk.DefragTwoRegion): Unsigned difference expression compared to zero
https://github.com/microsoft/GraphEngine/blob/e3c0e1946d5a49612ac394593de8145594efbdc5/src/Trinity.C/src/Storage/MemoryTrunk/MemoryTrunk.DefragTwoRegion.cpp#L43-L43
Fix the issue the result of the subtraction hole_right_offset - _bwd_cell_offset - _bwd_cell_size should be cast to a signed type (e.g., int64_t) before performing the comparison. This ensures that the subtraction can produce negative values, and the comparison > 0 will behave as intended.
Steps to fix:
- Cast the result of the subtraction to
int64_tbefore performing the comparison. - Ensure that the cast does not affect other parts of the code or introduce unintended side effects.