Commit 6f444b6e authored by Francois Cartegnie's avatar Francois Cartegnie

atsc_a64: fix incorrect iconv handling

parent 910e577d
...@@ -119,6 +119,9 @@ static bool convert_encoding_set( atsc_a65_handle_t *p_handle, ...@@ -119,6 +119,9 @@ static bool convert_encoding_set( atsc_a65_handle_t *p_handle,
size_t i_mergmin1 = *pi_mergmin1; size_t i_mergmin1 = *pi_mergmin1;
bool b_ret = true; bool b_ret = true;
if( i_src == 0 )
return NULL;
/* First exclude reserved ranges */ /* First exclude reserved ranges */
for( unsigned i=0; i<12; i+=2 ) for( unsigned i=0; i<12; i+=2 )
{ {
...@@ -160,13 +163,14 @@ static bool convert_encoding_set( atsc_a65_handle_t *p_handle, ...@@ -160,13 +163,14 @@ static bool convert_encoding_set( atsc_a65_handle_t *p_handle,
{ {
const char *p_inbuf = psz16; const char *p_inbuf = psz16;
char *p_outbuf = &psz_realloc[i_mergmin1]; char *p_outbuf = &psz_realloc[i_mergmin1];
size_t i_inbuf = i_src * 2; const size_t i_outbuf_size = i_src * 4;
size_t i_outbuf = i_src * 4; size_t i_inbuf_remain = i_src * 2;
b_ret = ( VLC_ICONV_ERR != vlc_iconv( p_handle->iconv16, &p_inbuf, &i_inbuf, size_t i_outbuf_remain = i_outbuf_size;
&p_outbuf, &i_outbuf ) ); b_ret = ( VLC_ICONV_ERR != vlc_iconv( p_handle->iconv16, &p_inbuf, &i_inbuf_remain,
&p_outbuf, &i_outbuf_remain ) );
psz_dest = psz_realloc; psz_dest = psz_realloc;
i_mergmin1 += i_outbuf; i_mergmin1 += (i_outbuf_size - i_outbuf_remain);
psz_dest[i_mergmin1] = 0; psz_dest[i_mergmin1 - 1] = 0;
} }
free( psz16 ); free( psz16 );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment