diff options
author | jstebbins <[email protected]> | 2011-07-07 17:25:38 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-07-07 17:25:38 +0000 |
commit | a001e1d5b6d546c2ac9527f0dd458b6d30f47688 (patch) | |
tree | ab7126b0c79717b31f4253bc090600bcb689b773 /libhb/bd.c | |
parent | 9b10934cd89546ae264bc939b723249371bc6e3c (diff) |
libhb: fix a stack corruption crash when scanning some BDs
was overrunning the end of a stack based array when there were more
than 32 clips in a BD title.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4086 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/bd.c')
-rw-r--r-- | libhb/bd.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/libhb/bd.c b/libhb/bd.c index 9231436f6..cd33479dd 100644 --- a/libhb/bd.c +++ b/libhb/bd.c @@ -312,28 +312,22 @@ hb_title_t * hb_bd_title_scan( hb_bd_t * d, int tt, uint64_t min_duration ) // So find the clip that has the most other clips with the // matching audio. // Max primary BD audios is 32 - uint8_t counts[32] = {0,}; - uint8_t matches[32] = {0,}; + int matches; int most_audio = 0; int audio_clip_index = 0; for ( ii = 0; ii < ti->clip_count; ii++ ) { - if ( matches[ii] ) continue; + matches = 0; for ( jj = 0; jj < ti->clip_count; jj++ ) { - if ( matches[jj] ) continue; if ( bd_audio_equal( &ti->clips[ii], &ti->clips[jj] ) ) { - matches[ii] = matches[jj] = 1; - counts[ii]++; + matches++; } } - } - for ( ii = 0; ii < ti->clip_count; ii++ ) - { - if ( most_audio < counts[ii] ) + if ( matches > most_audio ) { - most_audio = counts[ii]; + most_audio = matches; audio_clip_index = ii; } } |