[vlc-devel] [PATCH] avoid crash in atsc_a65.c
Abylay Ospan
aospan at netup.ru
Sun Aug 27 05:32:48 CEST 2017
Pointer to allocated memory incremented in cycle and then used to
'free' call. This cause crash because pointer is not pointing to
originally allocated memory.
Signed-off-by: Abylay Ospan <aospan at netup.ru>
---
modules/codec/atsc_a65.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/codec/atsc_a65.c b/modules/codec/atsc_a65.c
index 2f9491c..08174d9 100644
--- a/modules/codec/atsc_a65.c
+++ b/modules/codec/atsc_a65.c
@@ -95,7 +95,9 @@ static char *enlarge_to16( const uint8_t *p_src, size_t i_src, uint8_t i_prefix
if( i_src == 0 )
return NULL;
- char *psz_new = malloc( i_src * 2 + 1 );
+ char *psz_new_allocated = malloc( i_src * 2 + 1 );
+ char *psz_new = psz_new_allocated;
+
if( psz_new )
{
memset( psz_new, i_prefix, i_src * 2 );
@@ -107,7 +109,7 @@ static char *enlarge_to16( const uint8_t *p_src, size_t i_src, uint8_t i_prefix
psz_new += 2;
}
}
- return psz_new;
+ return psz_new_allocated;
}
static bool convert_encoding_set( atsc_a65_handle_t *p_handle,
--
2.7.4
More information about the vlc-devel
mailing list