Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid undefined behavior when subtracting tagged pointers (#715)
When compiling with HardwareAddressSanitizer, the top byte of pointers are tagged, hence subtracting two pointers may overflow. Overflow is undefined behavior for signed integers, resulting in errors such as: third_party/nanobind/src/nb_type.cpp:123:50: runtime error: signed integer overflow: -6701078944169102656 - 9079534012674239392 cannot be represented in type 'intptr_t' (aka 'long') This patch fixes the issue by using unsigned integers, for which overflow is well-defined.
- Loading branch information