Skip to content

Commit

Permalink
avcodec/dvdsubdec: Fix off by 1 error
Browse files Browse the repository at this point in the history
Fixes out of array read

Found-by: Thomas Garnier using libFuzzer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
  • Loading branch information
michaelni committed Oct 26, 2016
1 parent e936c8d commit c92f558
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libavcodec/dvdsubdec.c
Expand Up @@ -185,7 +185,7 @@ static void guess_palette(DVDSubContext* ctx,
for(i = 0; i < 4; i++) {
if (alpha[i] != 0) {
if (!color_used[colormap[i]]) {
level = level_map[nb_opaque_colors][j];
level = level_map[nb_opaque_colors - 1][j];
r = (((subtitle_color >> 16) & 0xff) * level) >> 8;
g = (((subtitle_color >> 8) & 0xff) * level) >> 8;
b = (((subtitle_color >> 0) & 0xff) * level) >> 8;
Expand Down

0 comments on commit c92f558

Please sign in to comment.