[FFmpeg-devel] [PATCH 1/3] ffmpeg: do not pass possibly undefined subtitles to sub2video_update

Nicolas George george at nsup.org
Sat Nov 23 19:57:06 CET 2013


Le tridi 3 frimaire, an CCXXII, Marton Balint a écrit :
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  ffmpeg.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 26cbbe3..ff39fe0 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1816,9 +1816,12 @@ static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output)
>          FFSWAP(AVSubtitle, subtitle,    ist->prev_sub.subtitle);
>      }
>  
> +    if (!*got_output)
> +        return ret;
> +
>      sub2video_update(ist, &subtitle);
>  
> -    if (!*got_output || !subtitle.num_rects)
> +    if (!subtitle.num_rects)
>          return ret;
>  
>      for (i = 0; i < nb_output_streams; i++) {

I do not object to the patch, but I believe this is completely unnecessary:
apart in case of ridiculous invalid API uses (that, of course, does not
happen in ffmpeg.c), the AVSubtitle structure is initialized to something
consistent, and the code guarantees that testing num_rects will not give a
false positive.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131123/3cf28750/attachment.asc>


More information about the ffmpeg-devel mailing list