diff options
| author | Mason Reed <mason@vector35.com> | 2025-02-11 22:09:59 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-02-12 18:43:02 -0500 |
| commit | 1cec22a86f7a844595266ccd6fcad9e79a914f26 (patch) | |
| tree | 85ec5f6cd8eab15095d852ff1fc1793a024a9660 /view/sharedcache/core/MetadataSerializable.cpp | |
| parent | c5edc003b1c0667c936c2ba3a278821da28c3b42 (diff) | |
[SharedCache] Fix crash when trying to deserialize a `routines_command_64` which had not been serialized.
We will just return early, this is fine as the previous code would effectively do the same thing.
Diffstat (limited to 'view/sharedcache/core/MetadataSerializable.cpp')
| -rw-r--r-- | view/sharedcache/core/MetadataSerializable.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/view/sharedcache/core/MetadataSerializable.cpp b/view/sharedcache/core/MetadataSerializable.cpp index ad8959f2..66a090c8 100644 --- a/view/sharedcache/core/MetadataSerializable.cpp +++ b/view/sharedcache/core/MetadataSerializable.cpp @@ -354,6 +354,10 @@ void Serialize(SerializationContext& context, const routines_command_64& value) void Deserialize(DeserializationContext& context, std::string_view name, routines_command_64& b) { auto bArr = context.doc[name.data()].GetArray(); + // Because we might open databases that had not previously serialized this, we must allow + // an empty array, otherwise we will crash! + if (bArr.Size() < 4) + return; b.cmd = bArr[0].GetUint(); b.cmdsize = bArr[1].GetUint(); b.init_address = bArr[2].GetUint(); |
