mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-18 08:49:55 +00:00
![Eric Fiselier](/assets/img/avatar_default.png)
Summary: This patch attempts to fix the undefined behavior in __hash_table by changing the node pointer types used throughout. The pointer types are changed for raw pointers in the current ABI and for fancy pointers in ABI V2 (since the fancy pointer types may not be ABI compatible). The UB in `__hash_table` arises because tree downcasts the embedded end node and then deferences that pointer. Currently there are 2 node types in __hash_table: * `__hash_node_base` which contains the `__next_` pointer. * `__hash_node` which contains `__hash_` and `__value_`. Currently the bucket list, iterators, and `__next_` pointers store pointers to `__hash_node` even though they all need to store `__hash_node_base` pointers. This patch makes that change by introducing a `__next_pointer` typedef which is a pointer to `__hash_node` in the current ABI and `__hash_node_base` afterwards. One notable change is to the type of `__bucket_list` which used to be defined as `unique_ptr<__node_pointer[], ...>` and is now `unique_ptr<__next_pointer[], ...>` meaning that we now allocate and deallocate different types using a different allocator. I'm going to give this part of the change more thought since it may introduce compatibility issues. This change is similar to D20786. Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D20787 llvm-svn: 276533
…
Description
llvm with tablegen backend for capstone disassembler
Languages
LLVM
34.8%
C++
32.8%
C
19.6%
Assembly
8.6%
MLIR
1.2%
Other
2.6%