From 93a5ce24453e12cde5d3b04cf6e300e74439c78e Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Mon, 13 Apr 2020 22:50:52 -0500 Subject: [PATCH] gdiplus: Check that GdipAddPathLine2 is passed at least one point. Signed-off-by: Jeff Smith Signed-off-by: Vincent Povirk Signed-off-by: Alexandre Julliard --- dlls/gdiplus/graphicspath.c | 2 +- dlls/gdiplus/tests/graphicspath.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 2b191dd30d0..4d5a73588f8 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -627,7 +627,7 @@ GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, TRACE("(%p, %p, %d)\n", path, points, count); - if(!path || !points) + if(!path || !points || count < 1) return InvalidParameter; if(!lengthen_path(path, count)) diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 0c5297249af..7670a6c41f7 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -308,6 +308,16 @@ static void test_line2(void) } GdipCreatePath(FillModeAlternate, &path); + + status = GdipAddPathLine2(NULL, line2_points, 2); + expect(InvalidParameter, status); + status = GdipAddPathLine2(path, NULL, 2); + expect(InvalidParameter, status); + status = GdipAddPathLine2(path, line2_points, 0); + expect(InvalidParameter, status); + status = GdipAddPathLine2(path, line2_points, -1); + expect(InvalidParameter, status); + status = GdipAddPathLine2(path, line2_points, 3); expect(Ok, status); status = GdipAddPathLine2(path, &(line2_points[3]), 3);