From: Nikolay Sivov Subject: gdi32: Clarify read length values used with get_font_data() Message-Id: <54756C85.5040508@codeweavers.com> Date: Wed, 26 Nov 2014 09:00:37 +0300 --- From 6c684988772b42883cd680440d65bf8a8a9a7a1c Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 25 Nov 2014 22:08:22 +0300 Subject: [PATCH] gdi32: Clarify read length values used with get_font_data() --- dlls/gdi32/freetype.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index b063c80..f1af5d6 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -4456,7 +4456,7 @@ typedef struct { static LONG load_VDMX(GdiFont *font, LONG height) { - WORD hdr[3], tmp; + WORD hdr[3]; VDMX_group group; BYTE devXRatio, devYRatio; USHORT numRecs, numRatios; @@ -4464,7 +4464,7 @@ static LONG load_VDMX(GdiFont *font, LONG height) LONG ppem = 0; int i; - result = get_font_data(font, MS_VDMX_TAG, 0, hdr, 6); + result = get_font_data(font, MS_VDMX_TAG, 0, hdr, sizeof(hdr)); if(result == GDI_ERROR) /* no vdmx table present, use linear scaling */ return ppem; @@ -4495,8 +4495,10 @@ static LONG load_VDMX(GdiFont *font, LONG height) devYRatio >= ratio.yStartRatio && devYRatio <= ratio.yEndRatio)) { + WORD tmp; + offset = (3 * 2) + (numRatios * 4) + (i * 2); - get_font_data(font, MS_VDMX_TAG, offset, &tmp, 2); + get_font_data(font, MS_VDMX_TAG, offset, &tmp, sizeof(tmp)); offset = GET_BE_WORD(tmp); break; } @@ -4504,7 +4506,7 @@ static LONG load_VDMX(GdiFont *font, LONG height) if(offset == -1) return 0; - if(get_font_data(font, MS_VDMX_TAG, offset, &group, 4) != GDI_ERROR) { + if(get_font_data(font, MS_VDMX_TAG, offset, &group, sizeof(group)) != GDI_ERROR) { USHORT recs; BYTE startsz, endsz; WORD *vTable; -- 2.1.3