]> git.ipfire.org Git - thirdparty/gettext.git/commit
intl: Fix undefined behaviour.
authorBruno Haible <bruno@clisp.org>
Wed, 29 Jan 2025 11:30:02 +0000 (12:30 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 29 Jan 2025 11:30:02 +0000 (12:30 +0100)
commit6954290401d2d25631840c73f20a612db8ea3b57
tree7c83f623d392f4f609c103ed93a62b1c4d3d4f7b
parent81add3eb2a222f47e6cd07de5735ae2f91b3f4f9
intl: Fix undefined behaviour.

Found using clang's undefined-behaviour sanitizer:
CC="clang -fsanitize=undefined -fno-sanitize-recover=undefined".
It reported errors
dcigettext.c:1219:25: runtime error: applying non-zero offset 8 to null pointer
because the code was computing
    outbuf = freemem + sizeof (size_t);
where freemem == NULL.

* gettext-runtime/intl/dcigettext.c (_nl_find_msg): Initialize outbuf only after
having verified that freemem_size >= sizeof (size_t).
gettext-runtime/intl/dcigettext.c