vlc | branch: master | Francois Cartegnie <[email protected]> | Mon Feb 8 22:55:38 2016 +0100| [6f444b6e56660e08005fe0baaf99104a992e068b] | committer: Francois Cartegnie
atsc_a64: fix incorrect iconv handling > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6f444b6e56660e08005fe0baaf99104a992e068b --- modules/codec/atsc_a65.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/codec/atsc_a65.c b/modules/codec/atsc_a65.c index 081bd7f..91aa3e5 100644 --- a/modules/codec/atsc_a65.c +++ b/modules/codec/atsc_a65.c @@ -119,6 +119,9 @@ static bool convert_encoding_set( atsc_a65_handle_t *p_handle, size_t i_mergmin1 = *pi_mergmin1; bool b_ret = true; + if( i_src == 0 ) + return NULL; + /* First exclude reserved ranges */ for( unsigned i=0; i<12; i+=2 ) { @@ -160,13 +163,14 @@ static bool convert_encoding_set( atsc_a65_handle_t *p_handle, { const char *p_inbuf = psz16; char *p_outbuf = &psz_realloc[i_mergmin1]; - size_t i_inbuf = i_src * 2; - size_t i_outbuf = i_src * 4; - b_ret = ( VLC_ICONV_ERR != vlc_iconv( p_handle->iconv16, &p_inbuf, &i_inbuf, - &p_outbuf, &i_outbuf ) ); + const size_t i_outbuf_size = i_src * 4; + size_t i_inbuf_remain = i_src * 2; + size_t i_outbuf_remain = i_outbuf_size; + b_ret = ( VLC_ICONV_ERR != vlc_iconv( p_handle->iconv16, &p_inbuf, &i_inbuf_remain, + &p_outbuf, &i_outbuf_remain ) ); psz_dest = psz_realloc; - i_mergmin1 += i_outbuf; - psz_dest[i_mergmin1] = 0; + i_mergmin1 += (i_outbuf_size - i_outbuf_remain); + psz_dest[i_mergmin1 - 1] = 0; } free( psz16 ); } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
