[vlc-devel] [PATCH 3/8] stream_ReadLine: properly discard incomplete UTF-16 sequences at EOF

Pierre Ynard linkfanel at yahoo.fr
Thu Oct 22 01:58:01 CEST 2020

> I don't know if it's only a problem with the comment or also with the
> code, but this won't actually handle incomplete sequences ending on a
> non-BMP code point.

It's a problem with the comment, this is only for lone bytes. I can
clarify it.

> And I'm not sure why this is needed at all. In fact, it seems wrong as
> EOF is not necessarily at a fixed offset. The missing byte(s) could
> show up on the next read attempt.

Well it is one way to fix that bug I mentioned. The bug is real. And
stream_Peek() blocks and internally attempts those next reads until the
requested amount of data was read, and the code always requests a bigger
(and even) data length, so the only way a lone byte would be returned is
that EOF was indeed reached.

If not, then we'd already have a more serious problem with line
splitting being completely broken for the same reason.

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