<div dir="ltr"><div>From 96521880d5cd05a6ebba077dde47cc9c26c1d008 Mon Sep 17 00:00:00 2001</div><div>From: Shaleen Jain <<a href="mailto:shaleen.jain95@gmail.com">shaleen.jain95@gmail.com</a>></div><div>Date: Fri, 23 Jun 2017 15:26:40 +0530</div><div>Subject: [PATCH] stream: error out on a failed conversion</div><div><br></div><div>---</div><div> src/input/stream.c | 4 +++-</div><div> 1 file changed, 3 insertions(+), 1 deletion(-)</div><div><br></div><div>diff --git a/src/input/stream.c b/src/input/stream.c</div><div>index affc7b2c0d..a7ea3bfa43 100644</div><div>--- a/src/input/stream.c</div><div>+++ b/src/input/stream.c</div><div>@@ -327,10 +327,12 @@ char *vlc_stream_ReadLine( stream_t *s )</div><div> p_in = p_line;</div><div> p_out = psz_new_line;</div><div> </div><div>- if( vlc_iconv( priv->text.conv, &p_in, &i_in, &p_out, &i_out ) == (size_t)-1 )</div><div>+ if( priv->text.conv == (vlc_iconv_t)-1 ||</div><div>+ vlc_iconv( priv->text.conv, &p_in, &i_in, &p_out, &i_out ) == (size_t)-1 )</div><div> {</div><div> msg_Err( s, "conversion error: %s", vlc_strerror_c( errno ) );</div><div> msg_Dbg( s, "original: %d, in %zu, out %zu", i_line, i_in, i_out );</div><div>+ goto error;</div><div> }</div><div> free( p_line );</div><div> p_line = psz_new_line;</div><div>-- </div><div>2.13.1</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 23, 2017 at 5:07 PM Thomas Guillem <<a href="mailto:thomas@gllm.fr">thomas@gllm.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On Fri, Jun 23, 2017, at 13:29, Shaleen Jain wrote:<br>
> ---<br>
> src/input/stream.c | 5 ++++-<br>
> 1 file changed, 4 insertions(+), 1 deletion(-)<br>
><br>
> diff --git a/src/input/stream.c b/src/input/stream.c<br>
> index affc7b2c0d..efc959319c 100644<br>
> --- a/src/input/stream.c<br>
> +++ b/src/input/stream.c<br>
> @@ -195,6 +195,7 @@ char *vlc_stream_ReadLine( stream_t *s )<br>
> if( i_pos == 0 && i_data >= 2 )<br>
> {<br>
> const char *psz_encoding = NULL;<br>
> + priv->text.conv = (vlc_iconv_t)-1;<br>
<br>
priv->text.conv is already initialized from vlc_stream_CommonNew(), why<br>
re-initializing it here ?<br>
<br>
><br>
> if( unlikely(priv->text.conv != (vlc_iconv_t)-1) )<br>
> { /* seek back to beginning? reset */<br>
> @@ -327,10 +328,12 @@ char *vlc_stream_ReadLine( stream_t *s )<br>
> p_in = p_line;<br>
> p_out = psz_new_line;<br>
><br>
> - if( vlc_iconv( priv->text.conv, &p_in, &i_in, &p_out, &i_out<br>
> ) == (size_t)-1 )<br>
> + if( priv->text.conv == (vlc_iconv_t)-1 ||<br>
> + vlc_iconv( priv->text.conv, &p_in, &i_in, &p_out,<br>
> &i_out ) == (size_t)-1 )<br>
> {<br>
> msg_Err( s, "conversion error: %s", vlc_strerror_c(<br>
> errno ) );<br>
> msg_Dbg( s, "original: %d, in %zu, out %zu", i_line,<br>
> i_in, i_out );<br>
> + goto error;<br>
<br>
OK for me.<br>
<br>
> }<br>
> free( p_line );<br>
> p_line = psz_new_line;<br>
> --<br>
> 2.13.1<br>
><br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> <a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a><br>
_______________________________________________<br>
vlc-devel mailing list<br>
To unsubscribe or modify your subscription options:<br>
<a href="https://mailman.videolan.org/listinfo/vlc-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/vlc-devel</a></blockquote></div>