Skip to content

Commit

Permalink
hb_get_best_mixdown: fix out-of-array reads.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5420 b64f7644-9d1e-0410-96f1-a4d463321fa5
  • Loading branch information
twalker314 committed Apr 28, 2013
1 parent 9f61b0e commit 61738cd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libhb/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,12 +994,12 @@ int hb_get_best_mixdown(uint32_t codec, uint64_t layout, int mixdown)

// caller requested the best available mixdown
if (mixdown == HB_INVALID_AMIXDOWN)
mixdown = hb_audio_mixdowns[hb_audio_mixdowns_count].amixdown;
mixdown = hb_audio_mixdowns[hb_audio_mixdowns_count - 1].amixdown;

int ii;
// test all mixdowns until an authorized, supported mixdown is found
// stop before we reach the "worst" non-None mixdown (index == 1)
for (ii = hb_audio_mixdowns_count; ii > 1; ii--)
for (ii = hb_audio_mixdowns_count - 1; ii > 1; ii--)
if (hb_audio_mixdowns[ii].amixdown <= mixdown &&
hb_mixdown_is_supported(hb_audio_mixdowns[ii].amixdown, codec, layout))
break;
Expand Down

0 comments on commit 61738cd

Please sign in to comment.