From 87e209085b23048c8724bc99920e8ba78db62b37 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 6 Apr 2011 16:54:53 -0500 Subject: [PATCH] gdiplus: Validate MatrixOrder in matrix functions. --- dlls/gdiplus/matrix.c | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c index 3798bd2..1035cc2 100644 --- a/dlls/gdiplus/matrix.c +++ b/dlls/gdiplus/matrix.c @@ -231,8 +231,10 @@ GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix* mat if(order == MatrixOrderAppend) matrix_multiply(matrix->matrix, matrix2->matrix, matrix->matrix); - else + else if (order == MatrixOrderPrepend) matrix_multiply(matrix2->matrix, matrix->matrix, matrix->matrix); + else + return InvalidParameter; return Ok; } @@ -260,8 +262,10 @@ GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, if(order == MatrixOrderAppend) matrix_multiply(matrix->matrix, rotate, matrix->matrix); - else + else if (order == MatrixOrderPrepend) matrix_multiply(rotate, matrix->matrix, matrix->matrix); + else + return InvalidParameter; return Ok; } @@ -285,8 +289,10 @@ GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, if(order == MatrixOrderAppend) matrix_multiply(matrix->matrix, scale, matrix->matrix); - else + else if (order == MatrixOrderPrepend) matrix_multiply(scale, matrix->matrix, matrix->matrix); + else + return InvalidParameter; return Ok; } @@ -330,8 +336,10 @@ GpStatus WINGDIPAPI GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, if(order == MatrixOrderAppend) matrix_multiply(matrix->matrix, shear, matrix->matrix); - else + else if (order == MatrixOrderPrepend) matrix_multiply(shear, matrix->matrix, matrix->matrix); + else + return InvalidParameter; return Ok; } @@ -410,8 +418,10 @@ GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, if(order == MatrixOrderAppend) matrix_multiply(matrix->matrix, translate, matrix->matrix); - else + else if (order == MatrixOrderPrepend) matrix_multiply(translate, matrix->matrix, matrix->matrix); + else + return InvalidParameter; return Ok; } -- 1.7.2.5