[FFmpeg-devel] [PATCH] make sure blending the subtitle does not write outside buffer
Reimar Döffinger
Reimar.Doeffinger
Sun Aug 5 11:00:04 CEST 2007
Hello,
attached patch fixes the subtitle rectangles so they do not lie outside
the video, which can cause crashes.
Greetings,
Reimar D?ffinger
-------------- next part --------------
diff --git a/ffplay.c b/ffplay.c
index 9af066e..b4cf038 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -705,7 +705,17 @@ static void video_image_display(VideoState *is)
pict.linesize[2] = vp->bmp->pitches[1];
for (i = 0; i < sp->sub.num_rects; i++)
+ {
+ sp->sub.rects[i].w = FFMIN(sp->sub.rects[i].w,
+ vp->bmp->w);
+ sp->sub.rects[i].h = FFMIN(sp->sub.rects[i].h,
+ vp->bmp->h);
+ sp->sub.rects[i].x = FFMIN(sp->sub.rects[i].x,
+ vp->bmp->w - sp->sub.rects[i].w);
+ sp->sub.rects[i].y = FFMIN(sp->sub.rects[i].y,
+ vp->bmp->h - sp->sub.rects[i].h);
blend_subrect(&pict, &sp->sub.rects[i]);
+ }
SDL_UnlockYUVOverlay (vp->bmp);
}
More information about the ffmpeg-devel
mailing list