]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-journal: always put verified object into the chain cache
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Jan 2024 19:30:24 +0000 (04:30 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 9 Feb 2024 15:26:17 +0000 (00:26 +0900)
commit1b4e322cdbf773e335e07554ad3e4a235f6e88cb
tree64ba069f0e2c5aa9c03471e3af260ba9619dc474
parent821d55a8d7b97ec346407290afb44517d197a0c7
sd-journal: always put verified object into the chain cache

Let's consider the case that
- the first array contains valid entries,
- all entries in the second array are corrupted.

Then, when we are going to upwards, and a call of generic_array_bisect()
matches the last entry of the first array, then the second array was
cached with last_index == UINT64_MAX, instead of the first array with
its last entry.
Hence, when generic_array_bisect() is called next time, the function call
of test() always fail. So, the cache entry is mostly meaningless.

Let's always store valid cache entry.
src/libsystemd/sd-journal/journal-file.c