]> git.ipfire.org Git - thirdparty/xz.git/commit
liblzma: Fix incorrect function type error from sanitizer
authorLasse Collin <lasse.collin@tukaani.org>
Tue, 30 Apr 2024 19:22:45 +0000 (22:22 +0300)
committerLasse Collin <lasse.collin@tukaani.org>
Tue, 30 Apr 2024 19:22:45 +0000 (22:22 +0300)
commit278563ef8f2b8d98d7f2c85e1a64ec1bc21d26d8
tree3c4a5616497f95a926b9628cc7f955e6c7e0217c
parent77c8f60547decefca8f2d0c905d9c708c38ee8ff
liblzma: Fix incorrect function type error from sanitizer

Clang 17 with -fsanitize=address,undefined:

    src/liblzma/common/filter_common.c:366:8: runtime error:
        call to function encoder_find through pointer to incorrect
        function type 'const lzma_filter_coder *(*)(unsigned long)'
    src/liblzma/common/filter_encoder.c:187: note:
        encoder_find defined here

Use a wrapper function to get the correct type neatly.
This reduces the number of casts needed too.

This issue could be a problem with control flow integrity (CFI)
methods that check the function type on indirect function calls.

Fixes: 3b34851de1eaf358cf9268922fa0eeed8278d680
src/liblzma/common/filter_decoder.c
src/liblzma/common/filter_encoder.c