]> wimlib.net Git - wimlib/commit
encoding.c: avoid UBSAN warning in convert_string()
authorEric Biggers <ebiggers3@gmail.com>
Tue, 28 Mar 2023 06:14:42 +0000 (23:14 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 28 Mar 2023 06:25:17 +0000 (23:25 -0700)
commit42d8e025e6456f31471b98fc309b729ab67289f5
tree6e411f3c217cd49fa66a97a872cc9bb8bc4a1d83
parent7993652656d5beeff805a8017566784adfdd36a1
encoding.c: avoid UBSAN warning in convert_string()

When 'in == NULL && in_nbytes == 0', the statement 'in_end = in +
in_nbytes' executes 'NULL + 0'.  clang's UndefinedBehaviorSanitizer
complains that this is undefined:

    src/encoding.c:223:31: runtime error: applying zero offset to null pointer

This is questionable, but let's avoid it...
src/encoding.c