From 9fd87c4954dae018cd2299568a46f3607d59b815 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 4 Aug 2010 00:01:30 +0000 Subject: [PATCH] [GDI32] Fix parameter check in GetTextExtentExPointA/W. Patch by Kamil Hornicek. Fixes bug 5486, bug 5507 and bug 5511 svn path=/trunk/; revision=48446 --- reactos/dll/win32/gdi32/objects/text.c | 13 +++++++++++++ reactos/subsystems/win32/win32k/include/text.h | 2 +- reactos/subsystems/win32/win32k/objects/freetype.c | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/gdi32/objects/text.c b/reactos/dll/win32/gdi32/objects/text.c index e5245716fcf..d64e01262f2 100644 --- a/reactos/dll/win32/gdi32/objects/text.c +++ b/reactos/dll/win32/gdi32/objects/text.c @@ -192,6 +192,13 @@ GetTextExtentExPointW( LPSIZE lpSize ) { + + if(nMaxExtent < -1) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + return NtGdiGetTextExtentExW ( hdc, (LPWSTR)lpszStr, cchString, nMaxExtent, (PULONG)lpnFit, (PULONG)alpDx, lpSize, 0 ); } @@ -216,6 +223,12 @@ GetTextExtentExPointA( LPWSTR lpszStrW; BOOL rc = 0; + if(nMaxExtent < -1) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + Status = HEAP_strdupA2W ( &lpszStrW, lpszStr ); if (!NT_SUCCESS (Status)) SetLastError (RtlNtStatusToDosError(Status)); diff --git a/reactos/subsystems/win32/win32k/include/text.h b/reactos/subsystems/win32/win32k/include/text.h index 8c764848233..a9a05779055 100644 --- a/reactos/subsystems/win32/win32k/include/text.h +++ b/reactos/subsystems/win32/win32k/include/text.h @@ -96,7 +96,7 @@ INT FASTCALL IntGdiAddFontResource(PUNICODE_STRING FileName, DWORD Characteristi ULONG FASTCALL ftGdiGetGlyphOutline(PDC,WCHAR,UINT,LPGLYPHMETRICS,ULONG,PVOID,LPMAT2,BOOL); INT FASTCALL IntGetOutlineTextMetrics(PFONTGDI,UINT,OUTLINETEXTMETRICW *); BOOL FASTCALL ftGdiGetRasterizerCaps(LPRASTERIZER_STATUS); -BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,int,int,LPINT,LPINT,LPSIZE); +BOOL FASTCALL TextIntGetTextExtentPoint(PDC,PTEXTOBJ,LPCWSTR,INT,ULONG,LPINT,LPINT,LPSIZE); BOOL FASTCALL ftGdiGetTextMetricsW(HDC,PTMW_INTERNAL); DWORD FASTCALL IntGetFontLanguageInfo(PDC); INT FASTCALL ftGdiGetTextCharsetInfo(PDC,PFONTSIGNATURE,DWORD); diff --git a/reactos/subsystems/win32/win32k/objects/freetype.c b/reactos/subsystems/win32/win32k/objects/freetype.c index 98d62ebd917..1c111e28fd8 100644 --- a/reactos/subsystems/win32/win32k/objects/freetype.c +++ b/reactos/subsystems/win32/win32k/objects/freetype.c @@ -2119,8 +2119,8 @@ FASTCALL TextIntGetTextExtentPoint(PDC dc, PTEXTOBJ TextObj, LPCWSTR String, - int Count, - int MaxExtent, + INT Count, + ULONG MaxExtent, LPINT Fit, LPINT Dx, LPSIZE Size)