[PATCH] iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)

Michael Colavita mcolavita@fb.com
Tue Nov 24 19:15:05 GMT 2020


> This may exit the loop prematurely when the input ends in irreversible
> characters.

To correct my explanation from before, resetting the input buffer assumes that
the output will be fully consumed given sufficient input. I don't believe it
affects correctness whether irreversible characters at the end are consumed or
not. If they are not skipped, they will be skipped in the next round of the
loop. The position to which we will have reset the input cursor is equivalent.

Currently the semantics of translation functions appear to be that reaching the
end of the output buffer terminates translation, even if there are further
irreversible characters that can be skipped. This is consistent across the
various routines.

However, if you think this behavior is undesirable, I can correct it across the
routines. If we pursue this route, I'm curious about the case when we are *not*
ignoring irreversible characters. If our output buffer is full and the next
input character is irreversible, would we continue to return
__GCONV_FULL_OUTPUT or instead return __GCONV_ILLEGAL_INPUT?

Let me know if you'd like me to pursue this and I can update the patch
accordingly (or submit the change separately if you agree that it does not
affect correctness).

Michael


More information about the Libc-alpha mailing list