-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The runlength optimization implicitly relies on the assumption that any particular log message is either never repeated, or always repeated at least twice.
This may not be true when logging depends on some condition:
#include <binary_log/binary_log.hpp>
int main() {
binary_log::binary_log<> logger("repro.bin");
for (int i = 0; i < 3; i++) {
BINARY_LOG(logger, "hui {}", i);
if (i == 0) {
BINARY_LOG(logger, "pizda {}", "pidor");
}
}
return 0;
}In this case, the runlength file will mention that the first message is repeated (which is indeed true for i equal to 1 and 2). However, the unpacker will incorrectly assume the repetition happened at the very first log record (i=0), which results in desync and a segfault during unpacking:
g++ --std=c++20 pizda.cpp -I include -o pizda && ./pizda && ./build/tools/unpacker/unpacker ./repro.bin
hui 0
hui 327681
Segmentation fault (core dumped)
Metadata
Metadata
Assignees
Labels
No labels