[vlc-devel] [PATCH] visual: don't crash on empty buffers
Tristan Matthews
le.businessman at gmail.com
Tue Apr 8 20:23:51 CEST 2014
Fixes #10533
---
modules/visualization/glspectrum.c | 5 +++++
modules/visualization/visual/effects.c | 10 ++++++++++
2 files changed, 15 insertions(+)
diff --git a/modules/visualization/glspectrum.c b/modules/visualization/glspectrum.c
index d3b40cc..023b0c7 100644
--- a/modules/visualization/glspectrum.c
+++ b/modules/visualization/glspectrum.c
@@ -447,6 +447,11 @@ static void *Thread( void *p_data )
int16_t *p_buffs; /* int16_t converted buffer */
int16_t *p_s16_buff; /* int16_t converted buffer */
+ if (!block->i_nb_samples) {
+ msg_Err(p_filter, "no samples yet");
+ goto release;
+ }
+
/* Allocate the buffer only if the number of samples change */
if (block->i_nb_samples != p_sys->i_prev_nb_samples)
{
diff --git a/modules/visualization/visual/effects.c b/modules/visualization/visual/effects.c
index ca2e1bd..c043cb0 100644
--- a/modules/visualization/visual/effects.c
+++ b/modules/visualization/visual/effects.c
@@ -119,6 +119,11 @@ static int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
int16_t *p_buffs; /* int16_t converted buffer */
int16_t *p_s16_buff; /* int16_t converted buffer */
+ if (!p_buffer->i_nb_samples) {
+ msg_Err(p_aout, "no samples yet");
+ return -1;
+ }
+
/* Create p_data if needed */
if( !p_data )
{
@@ -451,6 +456,11 @@ static int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
int16_t *p_buffs; /* int16_t converted buffer */
int16_t *p_s16_buff; /* int16_t converted buffer */
+ if (!p_buffer->i_nb_samples) {
+ msg_Err(p_aout, "no samples yet");
+ return -1;
+ }
+
/* Create the data struct if needed */
spectrometer_data *p_data = p_effect->p_data;
if( !p_data )
--
1.9.0
More information about the vlc-devel
mailing list