[vlc-commits] vout: osd: fix buffer overflow

Francois Cartegnie git at videolan.org
Fri Jun 1 15:43:05 CEST 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jun  1 15:04:47 2018 +0200| [160959e0d46562fdea20d5b4bcf97eadf4f3386a] | committer: Francois Cartegnie

vout: osd: fix buffer overflow

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=160959e0d46562fdea20d5b4bcf97eadf4f3386a
---

 src/video_output/video_widgets.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/video_output/video_widgets.c b/src/video_output/video_widgets.c
index d83a17f967..9644fe90cc 100644
--- a/src/video_output/video_widgets.c
+++ b/src/video_output/video_widgets.c
@@ -212,13 +212,16 @@ static subpicture_region_t *OSDIcon(int type, const video_format_t *fmt)
     const int x      = fmt->i_x_offset + fmt->i_visible_width - margin_ratio * size - width;
     const int y      = fmt->i_y_offset                        + margin_ratio * size;
 
+    if( width < 1 || height < 1 )
+        return NULL;
+
     subpicture_region_t *r = OSDRegion(__MAX(x, 0),
                                        __MIN(y, (int)fmt->i_visible_height - height),
                                        width, height);
     if (!r)
         return NULL;
 
-    DrawRect(r, STYLE_FILLED, COL_TRANSPARENT, 0, 0, width, height);
+    DrawRect(r, STYLE_FILLED, COL_TRANSPARENT, 0, 0, width - 1, height - 1);
 
     if (type == OSD_PAUSE_ICON) {
         int bar_width = width / 3;



More information about the vlc-commits mailing list