[vlc-commits] [Git][videolan/vlc][3.0.x] 5 commits: voc: check ES
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Aug 28 15:31:09 UTC 2025
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
9a1b2e83 by Rémi Denis-Courmont at 2025-08-28T14:32:53+00:00
voc: check ES
(cherry picked from commit 0d12b150747911a1facb869b4d1d78b9f287cdb4)
- - - - -
2b73b4e0 by Hugo Beauzée-Luyssen at 2025-08-28T14:32:53+00:00
voc: Reject blocks with a 0 samplerate
(cherry picked from commit 74b68b0f3b64096bc4b48a4eacf5204b85b508e8)
- - - - -
d69cf45d by Steve Lhomme at 2025-08-28T14:32:53+00:00
demux: voc: remove unneeded mulitplying by 1
(cherry picked from commit aa19e5e63463df006a97f54b7a52b12164a76809)
- - - - -
b698111a by Steve Lhomme at 2025-08-28T14:32:53+00:00
demux: voc: check the number of channels read is usable
(cherry picked from commit 34057a6d9d0e8de667c4bc7fe0960582061623f7)
- - - - -
30f31c7e by Steve Lhomme at 2025-08-28T14:32:53+00:00
demux: voc: limit the maximum sampling rate to 768000
Fixes https://code.videolan.org/videolan/vlc/-/issues/28978
(cherry picked from commit dd8256bfdb821871b7e25e32d5fb325cb679c5e6)
- - - - -
1 changed file:
- modules/demux/voc.c
Changes:
=====================================
modules/demux/voc.c
=====================================
@@ -29,6 +29,8 @@
# include "config.h"
#endif
+#include <assert.h>
+
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
@@ -230,15 +232,13 @@ static int ReadBlockHeader( demux_t *p_demux )
}
new_fmt.audio.i_channels = 1;
- new_fmt.audio.i_bytes_per_frame *= new_fmt.audio.i_channels;
new_fmt.audio.i_blockalign = new_fmt.audio.i_bytes_per_frame;
new_fmt.audio.i_frame_length = new_fmt.audio.i_bytes_per_frame * 8
/ new_fmt.audio.i_bitspersample;
new_fmt.audio.i_rate = fix_voc_sr( 1000000L / (256L - buf[0]) );
- new_fmt.i_bitrate = new_fmt.audio.i_rate * new_fmt.audio.i_bitspersample
- * new_fmt.audio.i_channels;
+ new_fmt.i_bitrate = new_fmt.audio.i_rate * new_fmt.audio.i_bitspersample;
break;
@@ -309,6 +309,7 @@ static int ReadBlockHeader( demux_t *p_demux )
}
new_fmt.i_codec = VLC_CODEC_U8;
+ static_assert( INPUT_CHAN_MAX > 32, "INPUT_CHAN_MAX too small" );
if (buf[3] >= 32)
goto corrupt;
new_fmt.audio.i_channels = buf[3] + 1; /* can't be nul */
@@ -352,6 +353,8 @@ static int ReadBlockHeader( demux_t *p_demux )
goto corrupt;
new_fmt.audio.i_rate = GetDWLE( buf );
+ if( new_fmt.audio.i_rate == 0 || new_fmt.audio.i_rate > 768000 )
+ goto corrupt;
new_fmt.audio.i_bitspersample = buf[4];
new_fmt.audio.i_channels = buf[5];
@@ -403,6 +406,11 @@ static int ReadBlockHeader( demux_t *p_demux )
msg_Err( p_demux, "0 channels detected" );
return VLC_EGENERIC;
}
+ if ( new_fmt.audio.i_channels > INPUT_CHAN_MAX )
+ {
+ msg_Err( p_demux, "too many channels detected %" PRIu8, new_fmt.audio.i_channels );
+ return VLC_EGENERIC;
+ }
new_fmt.audio.i_bytes_per_frame = new_fmt.audio.i_channels
* (new_fmt.audio.i_bitspersample / 8);
@@ -450,6 +458,8 @@ static int ReadBlockHeader( demux_t *p_demux )
memcpy( &p_sys->fmt, &new_fmt, sizeof( p_sys->fmt ) );
date_Change( &p_sys->pts, p_sys->fmt.audio.i_rate, 1 );
p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
+ if( unlikely(p_sys->p_es == NULL) )
+ return VLC_ENOMEM;
}
}
@@ -515,6 +525,7 @@ static int Demux( demux_t *p_demux )
p_block->i_nb_samples = i_read_frames * p_sys->fmt.audio.i_frame_length;
date_Increment( &p_sys->pts, p_block->i_nb_samples );
es_out_SetPCR( p_demux->out, p_block->i_pts );
+ assert(p_sys->p_es != NULL);
es_out_Send( p_demux->out, p_sys->p_es, p_block );
return 1;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d8973ad341a352addfd6344cde15214431a8aa2d...30f31c7ed61cf7ac57a7b2fd108338c75a258b89
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d8973ad341a352addfd6344cde15214431a8aa2d...30f31c7ed61cf7ac57a7b2fd108338c75a258b89
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list