Commit 40486dcf authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

libmpeg2: fix division by zero (fixes #2920)

parent d8e0025e
...@@ -285,9 +285,12 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) ...@@ -285,9 +285,12 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
if( p_sys->p_synchro ) if( p_sys->p_synchro )
decoder_SynchroRelease( p_sys->p_synchro ); decoder_SynchroRelease( p_sys->p_synchro );
if( p_sys->p_info->sequence->frame_period <= 0 )
p_sys->p_synchro = NULL;
else
p_sys->p_synchro = p_sys->p_synchro =
decoder_SynchroInit( p_dec, (uint32_t)((uint64_t)1001000000 * 27 / decoder_SynchroInit( p_dec, (uint32_t)(UINT64_C(1001000000) *
p_sys->p_info->sequence->frame_period) ); 27 / p_sys->p_info->sequence->frame_period) );
p_sys->b_after_sequence_header = true; p_sys->b_after_sequence_header = true;
break; break;
} }
...@@ -726,7 +729,9 @@ static void GetAR( decoder_t *p_dec ) ...@@ -726,7 +729,9 @@ static void GetAR( decoder_t *p_dec )
} }
} }
msg_Dbg( p_dec, "%dx%d (display %d,%d), aspect %d, sar %i:%i, %u.%03u fps", if( p_sys->p_info->sequence->frame_period > 0 )
msg_Dbg( p_dec,
"%dx%d (display %d,%d), aspect %d, sar %i:%i, %u.%03u fps",
p_sys->p_info->sequence->picture_width, p_sys->p_info->sequence->picture_width,
p_sys->p_info->sequence->picture_height, p_sys->p_info->sequence->picture_height,
p_sys->p_info->sequence->display_width, p_sys->p_info->sequence->display_width,
...@@ -736,6 +741,8 @@ static void GetAR( decoder_t *p_dec ) ...@@ -736,6 +741,8 @@ static void GetAR( decoder_t *p_dec )
p_sys->p_info->sequence->frame_period / 1001), p_sys->p_info->sequence->frame_period / 1001),
(uint32_t)((uint64_t)1001000000 * 27 / (uint32_t)((uint64_t)1001000000 * 27 /
p_sys->p_info->sequence->frame_period % 1001) ); p_sys->p_info->sequence->frame_period % 1001) );
else
msg_Dbg( p_dec, "bad frame period" );
} }
/***************************************************************************** /*****************************************************************************
......
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