diff --git a/Docs/src/history.but b/Docs/src/history.but index fec30a48..c4e4f2f9 100644 --- a/Docs/src/history.but +++ b/Docs/src/history.but @@ -28,6 +28,8 @@ ANSI targets are deprecated, consider moving to Unicode. \b StrFunc.nsh now supports a "using" idiom to help with forward-declaration of functions (\W{http://sf.net/p/nsis/bugs/1229}{bug #1229}) +\b Zero uninitialized data in icon group (\W{http://sf.net/p/nsis/bugs/1230}{bug #1230}) + \S2{} Translations \b Updated Hindi (\W{http://sf.net/p/nsis/patches/291}{patch #291}) and Portuguese (\W{http://sf.net/p/nsis/bugs/1219}{bug #1219}) diff --git a/Source/icon.cpp b/Source/icon.cpp index ca967a6d..97f78210 100644 --- a/Source/icon.cpp +++ b/Source/icon.cpp @@ -272,10 +272,11 @@ static IconPairs get_icon_order(IconGroup icon1, IconGroup icon2) #define destroy_icon_group(p) ( delete [] (p) ) static LPBYTE generate_icon_group(IconGroup icon, IconPairs order, bool first) { - LPBYTE group = new BYTE[ + size_t groupsize = sizeof(IconGroupHeader) // header - + order.size() * SIZEOF_RSRC_ICON_GROUP_ENTRY // entries - ]; + + order.size() * SIZEOF_RSRC_ICON_GROUP_ENTRY; // entries + LPBYTE group = new BYTE[groupsize]; + memset(group, 0, groupsize); // Reproducible builds (bug #1230) IconGroupHeader* header = (IconGroupHeader*) group;