[vlc-devel] [PATCH 1/3] stream_ReadLine: don't close iconv handle on error

Pierre Ynard linkfanel at yahoo.fr
Wed Sep 30 06:14:16 CEST 2020


> We should reset it for the corner case that it's interrupted on a lone
> surrogate. Is that what you mean?

I don't understand your email. I had never heard about lone surrogates
before you mentioned them, and I'm still not sure I understand them
correctly. I don't think that's what I meant.

In this particular patch, I meant a memory error, or line too long, or
whatever causes `goto error` (conversion errors are not one of those),
leaving character width and endianness parameters set without the iconv
handle they require.

I don't know what resetting a iconv handle would mean, apart from
closing it and opening a new one. I don't know what resetting can
accomplish with regard to invalid encoding in the input: I don't see
what state the iconv handle carries in between conversion calls.

> But I don't think we should delete it: There's not going to be another
> BOM at the beginning of non-first lines.

Yes, that's my point with this patch. The rest of the patchset is about
similar poor handling of the parameter set including the hypothetical
case that the stream gets seeked back to the beginning and the encoding
has somehow changed since last time. I have other refactoring patches
including moving BOM detection outside of the probing loop; but none
that improve the situation with invalid encoding in the middle of the
stream (apart from adding a comment pointing out that the rest of the
line gets lost on conversion error).

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list