[vlc-commits] access: dvdread: properly check GET_TITLE allocs
Francois Cartegnie
git at videolan.org
Mon Aug 19 20:49:32 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Aug 19 13:03:05 2019 +0200| [cdda541f8b80898c36b34db4d6bb1e319232b157] | committer: Francois Cartegnie
access: dvdread: properly check GET_TITLE allocs
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cdda541f8b80898c36b34db4d6bb1e319232b157
---
modules/access/dvdread.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index 4281143dbc..10138189bd 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -385,11 +385,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
*va_arg( args, int * ) = 1; /* Chapter offset */
/* Duplicate title infos */
- *pi_int = p_sys->i_titles;
+ *pi_int = 0;
*ppp_title = vlc_alloc( p_sys->i_titles, sizeof(input_title_t *) );
- for( i = 0; i < p_sys->i_titles; i++ )
+ if(!*ppp_title)
+ return VLC_EGENERIC;
+ for (i = 0; i < p_sys->i_title; i++)
{
- (*ppp_title)[i] = vlc_input_title_Duplicate(p_sys->titles[i]);
+ input_title_t *p_dup = vlc_input_title_Duplicate(p_sys->titles[i]);
+ if(p_dup)
+ (*ppp_title)[(*pi_int)++] = p_dup;
}
return VLC_SUCCESS;
More information about the vlc-commits
mailing list