mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 18:11:57 +00:00
Follow up of #1492. CORE-15755 - Use RtlULongMult function to check integer overflows.
This commit is contained in:
parent
811faed421
commit
bc9f3ed887
3 changed files with 19 additions and 7 deletions
|
@ -295,7 +295,9 @@ IntEnumFontFamilies(HDC Dc, const LOGFONTW *LogFont, PVOID EnumProc, LPARAM lPar
|
|||
ENUMLOGFONTEXA EnumLogFontExA;
|
||||
NEWTEXTMETRICEXA NewTextMetricExA;
|
||||
LOGFONTW lfW;
|
||||
LONG DataSize, InfoCount;
|
||||
LONG InfoCount;
|
||||
ULONG DataSize;
|
||||
NTSTATUS Status;
|
||||
|
||||
DataSize = INITIAL_FAMILY_COUNT * sizeof(FONTFAMILYINFO);
|
||||
Info = RtlAllocateHeap(GetProcessHeap(), 0, DataSize);
|
||||
|
@ -330,7 +332,13 @@ IntEnumFontFamilies(HDC Dc, const LOGFONTW *LogFont, PVOID EnumProc, LPARAM lPar
|
|||
if (INITIAL_FAMILY_COUNT < InfoCount)
|
||||
{
|
||||
RtlFreeHeap(GetProcessHeap(), 0, Info);
|
||||
DataSize = InfoCount * sizeof(FONTFAMILYINFO);
|
||||
|
||||
Status = RtlULongMult(InfoCount, sizeof(FONTFAMILYINFO), &DataSize);
|
||||
if (!NT_SUCCESS(Status) || DataSize > LONG_MAX)
|
||||
{
|
||||
DPRINT1("Overflowed.\n");
|
||||
return 1;
|
||||
}
|
||||
Info = RtlAllocateHeap(GetProcessHeap(), 0, DataSize);
|
||||
if (Info == NULL)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue