Skip to content

Commit c0afd95

Browse files
committed
improve
1 parent bb9c949 commit c0afd95

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/ResToText.hpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -1173,15 +1173,17 @@ inline MString ResToText::DoFontDir(const EntryBase& entry)
11731173

11741174
WORD wCount = *(const WORD *)pb;
11751175

1176-
if (size < sizeof(WORD) + 165 * wCount)
1177-
{
1178-
return str;
1179-
}
1180-
11811176
TCHAR szText[64];
11821177
StringCbPrintf(szText, sizeof(szText), TEXT("Count: %d\r\n---\r\n"), wCount);
11831178
str += szText;
11841179

1180+
#define FONTDIRENTRYSIZE 165
1181+
if (size < sizeof(WORD) + FONTDIRENTRYSIZE * wCount)
1182+
{
1183+
// NOTE: I think windres RT_FONTDIR is broken. Just ignore it.
1184+
return str;
1185+
}
1186+
11851187
pb += 2;
11861188
for (WORD i = 0; i < wCount; ++i)
11871189
{
@@ -1211,10 +1213,11 @@ inline MString ResToText::DoFontDir(const EntryBase& entry)
12111213
}
12121214

12131215
str += TEXT(")\r\n");
1214-
pb += 165;
1216+
pb += FONTDIRENTRYSIZE;
12151217
}
12161218

12171219
return str;
1220+
#undef FONTDIRENTRYSIZE
12181221
}
12191222

12201223
inline MString ResToText::DumpName(const MIdOrString& type, const MIdOrString& name)

0 commit comments

Comments
 (0)