[FFmpeg-devel] [PATCH] avformat/srtenc: avoid segmentation fault when transcoding from SSA to SRT

Nicolas George george at nsup.org
Sun Mar 8 11:02:45 CET 2015

L'octidi 18 ventôse, an CCXXIII, Gilles Chanteperdrix a écrit :
> If I read ffmpeg current documentation here:
> http://www.ffmpeg.org/doxygen/2.5/group__lavc__core.html#ga828218dcb8874ab2c5af8d486c365421
> It seems that when a subtitle rect type is SUBTITLE_ASS (which is
> the case in the code which my patch modified), there is no guarantee
> that the text field contains something.

You read the documentation correctly, but the "text" field you are testing
does not belong to AVSubtitleRect but to ASSDialog. And you can see that a
few lines above, the code checks that the subtitles are actually

> Is not there some way in the ssa format to declare some graphic
> elements which are not text?

Theoretically yes, but the ASS demuxer just ignores them.

> In my modest experience, bugs do not just disappear if you do not
> fix them.

In my modest experience, it can happen when the code that contains them is
reworked in depth, or when it was a consequence of another bug that was
fixed. This code has been reworked in depth.

> Maybe it is not a perfect patch, but if subtitles can contain
> graphic elements mixed with text, it seems better to translate the
> text only when the target codec only supports text, than to fail
> with a segmentation fault.

I do not deny that. But until proven otherwise, there is no segmentation
fault, the code as is works very well.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150308/f41318bf/attachment.asc>

More information about the ffmpeg-devel mailing list