[vlc-devel] [PATCH] libvlc: fix title count conditional for chapter descriptions

Alexandre Janniaux ajanni at videolabs.io
Fri Apr 9 13:27:28 UTC 2021


Hi,

LGTM.

Regards,
--
Alexandre Janniaux
Videolabs

On Thu, Apr 08, 2021 at 06:30:53PM +0100, Mark Lee wrote:
> Chapter descriptions were not being returned for valid title
> indices.
>
> The conditional check would return true (and therefore abort the
> method) when the requested title index was less than the title
> count, i.e. when it was valid.
> ---
>  lib/media_player.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 9341c49a68..61c354517f 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1364,7 +1364,7 @@ int libvlc_media_player_get_chapter_count_for_title(
>          goto end;
>
>      size_t titles_count = vlc_player_title_list_GetCount(titles);
> -    if (idx < titles_count)
> +    if (idx >= titles_count)
>         goto end;
>
>      const struct vlc_player_title *title =
> @@ -1489,7 +1489,7 @@ int libvlc_media_player_get_full_chapter_descriptions( libvlc_media_player_t *p_
>          goto end;
>
>      size_t titles_count = vlc_player_title_list_GetCount(titles);
> -    if (i_chapters_of_title < (int) titles_count)
> +    if (i_chapters_of_title >= (int) titles_count)
>         goto end;
>
>      const struct vlc_player_title *title =
> --
> 2.25.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list