[FFmpeg-cvslog] r25832 - trunk/libavcodec/ass.c
Reimar Döffinger
Reimar.Doeffinger
Sat Nov 27 08:02:52 CET 2010
On Sat, Nov 27, 2010 at 02:07:06AM +0100, aurel wrote:
> Author: aurel
> Date: Sat Nov 27 02:07:06 2010
> New Revision: 25832
>
> Log:
> ensure the ASS string in AVSubtitleRect is 0 terminated
>
> Modified:
> trunk/libavcodec/ass.c
>
> Modified: trunk/libavcodec/ass.c
> ==============================================================================
> --- trunk/libavcodec/ass.c Fri Nov 26 11:11:16 2010 (r25831)
> +++ trunk/libavcodec/ass.c Sat Nov 27 02:07:06 2010 (r25832)
> @@ -63,6 +63,7 @@ int ff_ass_add_rect(AVSubtitle *sub, con
> rects[sub->num_rects]->ass = av_malloc(len + dlen + 1);
> strcpy (rects[sub->num_rects]->ass , header);
> strncpy(rects[sub->num_rects]->ass + len, dialog, dlen);
> + rects[sub->num_rects]->ass[len+dlen] = 0;
Since I wouldn't consider this performance-critical:
We have functions like av_strlcpy or in this case
av_strlcat for this, that also avoids having to wonder
if the addition in av_malloc might allow for an integer
overflow or not.
More information about the ffmpeg-cvslog
mailing list