From 8016f559acb1c71f7d0257c20a63dadd5c7fa04f Mon Sep 17 00:00:00 2001 From: anders_k Date: Wed, 31 Jul 2019 19:59:55 +0000 Subject: [PATCH] Zero uninitialized icon group data for reproducible builds (bug #1230) git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7104 212acab6-be3b-0410-9dea-997c60f758d6 --- Docs/src/history.but | 2 ++ Source/icon.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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;