fix crash when reading msg log (#166)

This commit is contained in:
Manuel
2025-07-11 21:48:45 +02:00
committed by GitHub
parent 404c6e06ec
commit 86a09a7360
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -9,7 +9,8 @@
class ILogEntry
{
public:
virtual size_t size(void) const = 0;
virtual size_t size(void) const = 0; // size of the log entry, including header
virtual size_t length(void) const = 0; // length of the payload (without header)
virtual size_t serialize(std::function<size_t(const uint8_t *, size_t)> write) const = 0;
virtual size_t deserialize(std::function<size_t(uint8_t *, size_t)> read) = 0;
virtual ~ILogEntry() = default;
+2
View File
@@ -12,6 +12,8 @@ constexpr uint32_t messagePayloadSize = 233;
* Note: this struct does have vtable pointers, i.e. sizeof(LogMessageHeader)-8 is the real data size
*/
struct LogMessageHeader : public ILogEntry {
size_t length(void) const override { return _size; }
uint16_t _size;
time_t time;
uint32_t from;