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

Siddhesh Poyarekar siddhesh@gotplt.org
Fri Dec 4 04:03:48 GMT 2020


On 11/25/20 12:45 AM, Michael Colavita via Libc-alpha wrote:
>> 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).

This looks OK to me.  I'll commit the patch Nathan posted next week if 
Andreas does not have any further comments.

Thanks,
Siddhesh


More information about the Libc-alpha mailing list