Commit 5f26e7d3 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

libass: avoid negative index in array

(cherry picked from commit e91ea1f9c3f5575c65003818b6b0c2948435c2b8)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent f819406d
......@@ -627,11 +627,14 @@ static int BuildRegions( rectangle_t *p_region, int i_max_region, ASS_Image *p_i
#ifdef DEBUG_REGION
msg_Err( p_spu, "Merging %d and %d", i_best_i, i_best_j );
#endif
r_add( &region[i_best_i], &region[i_best_j] );
if( i_best_j >= 0 && i_best_i >= 0 )
{
r_add( &region[i_best_i], &region[i_best_j] );
if( i_best_j+1 < i_region )
memmove( &region[i_best_j], &region[i_best_j+1], sizeof(*region) * ( i_region - (i_best_j+1) ) );
i_region--;
if( i_best_j+1 < i_region )
memmove( &region[i_best_j], &region[i_best_j+1], sizeof(*region) * ( i_region - (i_best_j+1) ) );
i_region--;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment