[BUG] False positive vptr errors with shared ubsan runtimes(which is the default)
- Dominant language
- No language data
- Stars
- 2.3k
- Forks
- 310
- PR merge metrics
- No merged PRs in 30d
Description
### Description
### **Env Info:**
> 【Compile Sdk Version】33
> 【NDK Version】R21e
> 【JDK】Java 8
### **Error Info:**
```
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I /Users/cwx/work/codes/gitCodes/inanna/inanna-framework/demos/android/inanna-android/app/src/main/cpp/native-lib.cpp:42:22: runtime error: member call on address 0x0041793d7bf0 which does not point to an object of type 'Base'
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I 0x0041793d7bf0: note: object is of type 'Derived'
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I 00 00 00 00 f0 95 db 13 71 00 00 00 00 00 00 00 be be be be 02 11 00 00 10 00 00 00 5b 27 00 00
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I ^~~~~~~~~~~~~~~~~~~~~~~
2024-08-29 09:55:10.324 18568-18568 app_process64 com.cwx.inanna_android I vptr for 'Derived'
```
### **C++ Code:**
```
// Base.h
class Base {
public:
virtual ~Base();
virtual int foo();
int bar();
};
// Base.cpp
Base::~Base()
{
}
int Base::foo()
{
return 1;
}
int Base::bar() {
return 2;
}
// Derived.h
class Derived : public Base {
public:
int foo() override;
};
// Derived.cpp
int Derived::foo() {
return bar() + Base::foo();
}
int init() {
Base *pBase = new Derived();
int ret = pBase->foo();
delete pBase;
return ret;
}
```
**### cmake options:**
```
target_compile_options(inanna_android PUBLIC -fsanitize=address -fno-omit-frame-pointer)
target_link_options(inanna_android PUBLIC -fsanitize=address)
target_compile_options(inanna_android PUBLIC -fsanitize=undefined -fno-sanitize-recover=undefined)
target_link_options(inanna_android PUBLIC -fsanitize=undefined -fno-sanitize-recover=undefined)
```
### **described:**
When I turned on one of the options separately, it worked well.Or if I turn off the vptr check, it can work well,but when i both open ASAN and UBASAN,the error coming...
### Affected versions
Canary
### Canary version
NDKr21e
### Host OS
Mac
### Host OS version
14.2.1
### Affected ABIs
arm64-v8a
### Build system
CMake
### Other build system
_No response_
### minSdkVersion
24
### Device API level
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.