Commit 17135fda authored by Ilkka Ollakka's avatar Ilkka Ollakka

subtitle: handle INT_MAX in qsort

Return only -1,0,1 and not directly subtraction, as like Remi pointed
out, result can exceed INT_MAX.
parent 11074cb8
...@@ -761,7 +761,10 @@ static int Demux( demux_t *p_demux ) ...@@ -761,7 +761,10 @@ static int Demux( demux_t *p_demux )
static int subtitle_cmp( const void *first, const void *second ) static int subtitle_cmp( const void *first, const void *second )
{ {
return ((subtitle_t *)(first))->i_start - ((subtitle_t *)(second))->i_start; int64_t result = ((subtitle_t *)(first))->i_start - ((subtitle_t *)(second))->i_start;
/* Return -1, 0 ,1, and not directly substraction
* as result can be > INT_MAX */
return result == 0 ? 0 : result > 0 ? 1 : -1;
} }
/***************************************************************************** /*****************************************************************************
* Fix: fix time stamp and order of subtitle * Fix: fix time stamp and order of subtitle
......
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