[vlc-commits] stream_ReadLine: reset iconv state on conversion error

Pierre Ynard git at videolan.org
Tue Oct 27 09:10:12 CET 2020


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Oct 27 08:48:23 2020 +0100| [4a0c695ab38344822d2b4902e101e6a077ea0acb] | committer: Pierre Ynard

stream_ReadLine: reset iconv state on conversion error

Tested against UTF-16 lone surrogates, for which it seems to make no
difference

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a0c695ab38344822d2b4902e101e6a077ea0acb
---

 src/input/stream.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/input/stream.c b/src/input/stream.c
index 65e1e241f3..90278ea59d 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -350,6 +350,9 @@ char *vlc_stream_ReadLine( stream_t *s )
             {
                 msg_Err( s, "conversion error: %s", vlc_strerror_c( errno ) );
                 msg_Dbg( s, "original: %d, in %zu, out %zu", i_line, i_in, i_out );
+                /* Reset state */
+                size_t r = vlc_iconv( priv->text.conv, NULL, NULL, NULL, NULL );
+                VLC_UNUSED( r );
             }
             free( p_line );
             p_line = psz_new_line;



More information about the vlc-commits mailing list