gdiplus: Check for invalid coordinate space in GdipTransformPoints.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2017-08-28 11:42:13 -05:00 committed by Alexandre Julliard
parent 8c593bd37a
commit 5c12cede8d
2 changed files with 12 additions and 1 deletions

View File

@ -6606,7 +6606,9 @@ GpStatus WINGDIPAPI GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace
GpMatrix matrix; GpMatrix matrix;
GpStatus stat; GpStatus stat;
if(!graphics || !points || count <= 0) if(!graphics || !points || count <= 0 ||
dst_space < 0 || dst_space > CoordinateSpaceDevice ||
src_space < 0 || src_space > CoordinateSpaceDevice)
return InvalidParameter; return InvalidParameter;
if(graphics->busy) if(graphics->busy)

View File

@ -1868,6 +1868,15 @@ static void test_transformpoints(void)
status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, -1); status = GdipTransformPoints(graphics, CoordinateSpacePage, CoordinateSpaceWorld, ptf, -1);
expect(InvalidParameter, status); expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, CoordinateSpaceDevice+1, CoordinateSpaceWorld, ptf, 2);
expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, -1, CoordinateSpaceWorld, ptf, 2);
expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, CoordinateSpaceDevice, CoordinateSpaceDevice+1, ptf, 2);
expect(InvalidParameter, status);
status = GdipTransformPoints(graphics, CoordinateSpaceDevice, -1, ptf, 2);
expect(InvalidParameter, status);
ptf[0].X = 1.0; ptf[0].X = 1.0;
ptf[0].Y = 0.0; ptf[0].Y = 0.0;
ptf[1].X = 0.0; ptf[1].X = 0.0;