mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-29 10:17:39 +02:00
Fix UBSAN error "member call does not point to an object of type"
runtime error: member call on address XXX which does not point to an object of type 'Allocator' XXX: note: object is of type 'SpyingAllocator' This is due to the fact that some of the compilation units have different library settings, so a different namespace, and therefore a different `Allocator` class.
This commit is contained in:
@ -10,6 +10,8 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
namespace {
|
||||
|
||||
struct FailingAllocator : ArduinoJson::Allocator {
|
||||
static FailingAllocator* instance() {
|
||||
static FailingAllocator allocator;
|
||||
@ -260,6 +262,7 @@ class TimebombAllocator : public ArduinoJson::Allocator {
|
||||
size_t countdown_ = 0;
|
||||
Allocator* upstream_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
inline size_t sizeofPoolList(size_t n = ARDUINOJSON_INITIAL_POOL_COUNT) {
|
||||
return sizeof(ArduinoJson::detail::VariantPool) * n;
|
||||
|
Reference in New Issue
Block a user