mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 08:39:34 +00:00
gdiplus: Reject zero-width/zero-height rectangles.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55351 Signed-off-by: David Kahurani <k.kahurani@gmail.com>
This commit is contained in:
parent
99f0d3d790
commit
d58d990256
|
@ -283,10 +283,10 @@ static GpStatus extend_current_figure(GpPath *path, GDIPCONST PointF *points, IN
|
|||
*
|
||||
* PARAMS
|
||||
* path [I/O] Path that the arc is appended to
|
||||
* x1 [I] X coordinate of the boundary box
|
||||
* y1 [I] Y coordinate of the boundary box
|
||||
* x2 [I] Width of the boundary box
|
||||
* y2 [I] Height of the boundary box
|
||||
* x [I] X coordinate of the boundary rectangle
|
||||
* y [I] Y coordinate of the boundary rectangle
|
||||
* width [I] Width of the boundary rectangle
|
||||
* height [I] Height of the boundary rectangle
|
||||
* startAngle [I] Starting angle of the arc, clockwise
|
||||
* sweepAngle [I] Angle of the arc, clockwise
|
||||
*
|
||||
|
@ -302,20 +302,20 @@ static GpStatus extend_current_figure(GpPath *path, GDIPCONST PointF *points, IN
|
|||
* In both cases, the value of newfigure of the given path is FALSE
|
||||
* afterwards.
|
||||
*/
|
||||
GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x1, REAL y1, REAL x2,
|
||||
REAL y2, REAL startAngle, REAL sweepAngle)
|
||||
GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width,
|
||||
REAL height, REAL startAngle, REAL sweepAngle)
|
||||
{
|
||||
GpPointF *points;
|
||||
GpStatus status;
|
||||
INT count;
|
||||
|
||||
TRACE("(%p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n",
|
||||
path, x1, y1, x2, y2, startAngle, sweepAngle);
|
||||
path, x, y, width, height, startAngle, sweepAngle);
|
||||
|
||||
if(!path)
|
||||
if(!path || width <= 0.0f || height <= 0.0f)
|
||||
return InvalidParameter;
|
||||
|
||||
count = arc2polybezier(NULL, x1, y1, x2, y2, startAngle, sweepAngle);
|
||||
count = arc2polybezier(NULL, x, y, width, height, startAngle, sweepAngle);
|
||||
if(count == 0)
|
||||
return Ok;
|
||||
|
||||
|
@ -323,7 +323,7 @@ GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x1, REAL y1, REAL x2,
|
|||
if(!points)
|
||||
return OutOfMemory;
|
||||
|
||||
arc2polybezier(points, x1, y1, x2, y2, startAngle, sweepAngle);
|
||||
arc2polybezier(points, x, y, width, height, startAngle, sweepAngle);
|
||||
|
||||
status = extend_current_figure(path, points, count, PathPointTypeBezier);
|
||||
|
||||
|
|
|
@ -451,6 +451,20 @@ static void test_arc(void)
|
|||
GpPath* path;
|
||||
|
||||
GdipCreatePath(FillModeAlternate, &path);
|
||||
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, 1.0, 0.0, 0.0, 90.0);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, 0.0, 1.0, 0.0, 90.0);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, -40, 1.0, 0.0, 90.0);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, 1.0, -50.0, 0.0, 90.0);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
GdipResetPath(path);
|
||||
/* Exactly 90 degrees */
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
|
||||
expect(Ok, status);
|
||||
|
@ -1263,21 +1277,8 @@ static void test_flatten2(void)
|
|||
status = GdipStartPathFigure(path);
|
||||
expect(Ok, status);
|
||||
|
||||
/* path seen in the wild that caused a stack overflow */
|
||||
status = GdipAddPathArc(path, -136.33, 20.00, 786.00, 786.00, -105.00, 30.00);
|
||||
expect(Ok, status);
|
||||
status = GdipAddPathArc(path, 256.67, 413.00, 0.00, 0.00, -75.00, -30.00);
|
||||
expect(Ok, status);
|
||||
status = GdipClosePathFigure(path);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipFlattenPath(path, NULL, 1.0);
|
||||
expect(Ok, status);
|
||||
|
||||
/* path seen in the wild that caused a stack overflow */
|
||||
/* same path but redo with the manual points that caused a crash */
|
||||
status = GdipResetPath(path);
|
||||
expect(Ok, status);
|
||||
status = GdipAddPathBezier(path, 154.950806, 33.391144, 221.586075, 15.536285, 291.747314, 15.536285, 358.382568, 33.391144);
|
||||
expect(Ok, status);
|
||||
status = GdipAddPathBezier(path, 256.666809, 412.999512, 256.666718, 412.999481, 256.666656, 412.999481, 256.666565, 412.999512);
|
||||
|
|
Loading…
Reference in a new issue