Skip to content

Commit c455d11

Browse files
committed
ogg: Fix potential integer overflow
1 parent 87b7816 commit c455d11

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/demux/ogg.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,7 +2654,8 @@ static bool Ogg_ReadDaalaHeader( logical_stream_t *p_stream,
26542654
oggpack_buffer opb;
26552655
uint32_t i_timebase_numerator;
26562656
uint32_t i_timebase_denominator;
2657-
int i_keyframe_frequency_force;
2657+
int keyframe_granule_shift;
2658+
unsigned int i_keyframe_frequency_force;
26582659
uint8_t i_major;
26592660
uint8_t i_minor;
26602661
uint8_t i_subminor;
@@ -2688,7 +2689,9 @@ static bool Ogg_ReadDaalaHeader( logical_stream_t *p_stream,
26882689

26892690
oggpack_adv( &opb, 32 ); /* frame duration */
26902691

2691-
i_keyframe_frequency_force = 1 << oggpack_read( &opb, 8 );
2692+
keyframe_granule_shift = oggpack_read( &opb, 8 );
2693+
keyframe_granule_shift = __MIN(keyframe_granule_shift, 31);
2694+
i_keyframe_frequency_force = 1u << keyframe_granule_shift;
26922695

26932696
/* granule_shift = i_log( frequency_force -1 ) */
26942697
p_stream->i_granule_shift = 0;

0 commit comments

Comments
 (0)