Bruno Haible <[email protected]> さんはかきました:

> The mem_iconveh functions is documented to return an offsets[] array:
>
>    If OFFSETS is not NULL, it should point to an array of SRCLEN integers; 
> this
>    array is filled with offsets into the result, i.e. the character starting
>    at SRC[i] corresponds to the character starting at (*RESULTP)[OFFSETS[i]],
>    and other offsets are set to (size_t)(-1).
>
> In a couple of cases, OFFSETS[i] can point to the end of the result string:
>   - When the input ends in an invalid character and handler == iconveh_error,
>   - When the input is in a stateful encoding and ends in a shift sequence,
>   - When the input ends in one or more Unicode LANGUAGE TAG characters.
>
> None of these leads to a bug in libunistring. But it's worth fixing anyway.
>
>
> 2026-08-16  Bruno Haible  <[email protected]>
>
>       striconveh: Ensure that none of the offsets[] are out-of-range.
>       Reported by AISLE via Mike Fabian <[email protected]>.
>       * lib/striconveh.c (mem_cd_iconveh_internal): Ensure that no offsets[i]
>       is == length.
>       * tests/test-striconveh.c (main): Adjust expected contents of the
>       offsets[] array.
>       * lib/striconveh.c (main): Likewise.
>       * tests/test-striconveh.c (main): Likewise.
>       * tests/test-striconveha.c (main): Likewise.
>       * tests/uniconv/test-u8-conv-from-enc.c (main): Likewise.
>       * tests/uniconv/test-u16-conv-from-enc.c (main): Likewise.
>       * tests/uniconv/test-u32-conv-from-enc.c (main): Likewise.
>       * tests/uniconv/test-u8-conv-to-enc.c (main): Likewise.
>       * tests/uniconv/test-u16-conv-to-enc.c (main): Likewise.
>
>       striconveh tests: Add some more test cases.
>       * tests/test-striconveh.c (main): Add some more test cases for
>       mem_iconveh() with offsets.

Great! Thank you very much for the quick fix!

-- 
Mike FABIAN <[email protected]>
He/Him/His
睡眠不足はいい仕事の敵だ。


Reply via email to