Heap corruption
Description
When does the problem happen
- [ ] During build
- [x ] During run-time
- [ ] When capturing a hard crash
Environment
- OS: Windows 10, 64-bit
- Compiler: MSVC 19
- CMake version and config: 3.23.1
- conan 1.48.0 all default options: backend: inproc fPIC: True performance: False qt: False shared: False transport: curl with_breakpad: sentry with_crashpad: sentry
Steps To Reproduce
void updateUserMail(const QString& userIdentifier) { sentry_value_t user = sentry_value_new_object(); sentry_value_set_by_key(user, "email", sentry_value_new_string(userIdentifier.toLocal8Bit().constData())); sentry_set_user(user); } Log output Debug build produces such output: HEAP: Free Heap block 0000013043A00E60 modified at 0000013043A00F28 after it was freed
11 sentry_malloc sentry_alloc.c 22 0x7ff702367f05 12 reserve sentry_value.c 124 0x7ff70236216b 13 sentry_value_set_by_key sentry_value.c 459 0x7ff70235fc9f 14 sentry__get_os_context sentry_os.c 37 0x7ff7023998fe 15 get_scope sentry_scope.c 75 0x7ff702396cad 16 sentry__scope_lock sentry_scope.c 112 0x7ff7023960d7 17 sentry_set_user sentry_core.c 600 0x7ff702365393
Hi!
Is the environment you provided correct? You mention qt: false, but that QString sounds very much like qt.
Either way, the stack trace you posted points directly to malloc; is that the allocation that was being modified? Or the code that did the modification? Probably the former, since I doubt system malloc will itself use-after-free.
Can you reproduce this if you set a null user?
Yes. maybe I will need to set qt flag to true. But that's not really related to the issue I think.
I don't modify any sentry code, the only code I use are 6 lines after "Steps To Reproduce"
If I comment out 'sentry_value_set_by_key', the problem is still there