diff options
author | eddyg <[email protected]> | 2008-08-18 04:25:18 +0000 |
---|---|---|
committer | eddyg <[email protected]> | 2008-08-18 04:25:18 +0000 |
commit | 7628e62c73fc0010c29647bb8fcb7471e368aa5e (patch) | |
tree | 52cbe0d0229b85f2541ec97839ca3a0958948ded | |
parent | 1c4d7309b2924c283f9922adda37d93ad1beca88 (diff) |
Don't crash when the user specifies audio tracks that don't exist from the HandBrakeCLI
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1640 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r-- | libhb/common.c | 9 | ||||
-rw-r--r-- | test/test.c | 7 |
2 files changed, 13 insertions, 3 deletions
diff --git a/libhb/common.c b/libhb/common.c index c8cc8dddc..f0ad9e4a2 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -667,8 +667,13 @@ void hb_filter_close( hb_filter_object_t ** _f ) *********************************************************************/ hb_audio_t *hb_audio_copy(const hb_audio_t *src) { - hb_audio_t *audio = calloc(1, sizeof(*audio)); - memcpy(audio, src, sizeof(*audio)); + hb_audio_t *audio = NULL; + + if( src ) + { + audio = calloc(1, sizeof(*audio)); + memcpy(audio, src, sizeof(*audio)); + } return audio; } diff --git a/test/test.c b/test/test.c index 3fd9d0e62..01cd715f8 100644 --- a/test/test.c +++ b/test/test.c @@ -965,7 +965,12 @@ static int HandleEvents( hb_handle_t * h ) } else { - hb_audio_add( job, audio ); + if( hb_audio_add( job, audio ) == 0 ) + { + fprintf(stderr, "ERROR: Invalid audio input track '%u', skipping.\n", + audio->in.track + 1 ); + num_audio_tracks--; + } } hb_list_rem(audios, audio); if( audio != NULL) |