gdi32: Check that emf records are within the file.

Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vincent Povirk 2018-05-08 12:46:20 -05:00 committed by Alexandre Julliard
parent 8d2676fd14
commit b6da3547d8
1 changed files with 8 additions and 0 deletions

View File

@ -2470,6 +2470,14 @@ BOOL WINAPI EnumEnhMetaFile(
{
emr = (ENHMETARECORD *)((char *)emh + offset);
if (offset + 8 > emh->nBytes ||
offset > offset + emr->nSize ||
offset + emr->nSize > emh->nBytes)
{
WARN("record truncated\n");
break;
}
/* In Win9x mode we update the xform if the record will produce output */
if (hdc && IS_WIN9X() && emr_produces_output(emr->iType))
EMF_Update_MF_Xform(hdc, info);