]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stats-file: add some BUG_ON() guards to ensure exported structs are not chang...
authorAurelien DARRAGON <adarragon@haproxy.com>
Wed, 3 Sep 2025 14:23:33 +0000 (16:23 +0200)
committerAurelien DARRAGON <adarragon@haproxy.com>
Wed, 3 Sep 2025 14:29:55 +0000 (16:29 +0200)
commitf32bc8f0a445341e3f88c56303d92b2378c7920f
tree056d7aa9046bcdf27caef7b6d11740e4149decd4
parent1a1362ea0b50fec501cad8f37a7f41e7e5158f65
MEDIUM: stats-file: add some BUG_ON() guards to ensure exported structs are not changed by accident

Add two BUG_ON() in shm_stats_file_prepare() which will trigger if
exported structures (shm_stats_file_hdr and shm_stats_file_object) change
in size, because it means that they will become incompatible with older
versions and thus precautions should be taken by the developer to ensure
compatibility with olders versions, or at least detect incompatible
versions by changing the version number to prevent bugs resulting
from inconsistent mapping between versions. The BUG_ON() may be
safely adjusted then.

Please note that it doesn't protect against accidental struct member
re-ordering if the resulting struct size is equal..
src/stats-file.c