From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Liming Gao <liming.gao@intel.com>,
Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [PATCH 14/17] BaseTools/VfrCompile: Resolve uninit class variables in constructor
Date: Tue, 19 Dec 2017 11:29:09 +0800 [thread overview]
Message-ID: <20171219032912.14404-15-hao.a.wu@intel.com> (raw)
In-Reply-To: <20171219032912.14404-1-hao.a.wu@intel.com>
The commit initializes those possibly uninitialized class variables in
class constructors.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
BaseTools/Source/C/VfrCompile/VfrError.cpp | 1 +
BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp | 6 ++++++
BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp | 3 +++
3 files changed, 10 insertions(+)
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp
index 0f8f7dd891..2366fac5a7 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
@@ -67,6 +67,7 @@ CVfrErrorHandle::CVfrErrorHandle (
mScopeRecordListTail = NULL;
mVfrErrorHandleTable = VFR_ERROR_HANDLE_TABLE;
mVfrWarningHandleTable = VFR_WARNING_HANDLE_TABLE;
+ mWarningAsError = FALSE;
}
CVfrErrorHandle::~CVfrErrorHandle (
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
index b8350623f2..0f0efd4c6d 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -104,8 +104,13 @@ CFormPkg::CFormPkg (
SBufferNode *Node;
mPkgLength = 0;
+ mBufferSize = 0;
mBufferNodeQueueHead = NULL;
+ mBufferNodeQueueTail = NULL;
mCurrBufferNode = NULL;
+ mReadBufferNode = NULL;
+ mReadBufferOffset = 0;
+ PendingAssignList = NULL;
Node = new SBufferNode;
if (Node == NULL) {
@@ -2421,6 +2426,7 @@ CIfrObj::CIfrObj (
mObjBinLen = (ObjBinLen == 0) ? gOpcodeSizesScopeTable[OpCode].mSize : ObjBinLen;
mObjBinBuf = ((DelayEmit == FALSE) && (gCreateOp == TRUE)) ? gCFormPkg.IfrBinBufferGet (mObjBinLen) : new CHAR8[EFI_IFR_MAX_LENGTH];
mRecordIdx = (gCreateOp == TRUE) ? gCIfrRecordInfoDB.IfrRecordRegister (0xFFFFFFFF, mObjBinBuf, mObjBinLen, mPkgOffset) : EFI_IFR_RECORDINFO_IDX_INVALUD;
+ mLineNo = 0;
assert (mObjBinBuf != NULL);
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index 4866639aab..c536498d77 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -958,6 +958,7 @@ CVfrVarDataTypeDB::CVfrVarDataTypeDB (
mPackAlign = DEFAULT_PACK_ALIGN;
mPackStack = NULL;
mFirstNewDataTypeName = NULL;
+ mCurrDataType = NULL;
InternalTypesListInit ();
}
@@ -1605,6 +1606,7 @@ SVfrVarStorageNode::SVfrVarStorageNode (
IN EFI_VARSTORE_ID VarStoreId
)
{
+ memset (&mGuid, 0, sizeof (EFI_GUID));
if (StoreName != NULL) {
mVarStoreName = new CHAR8[strlen(StoreName) + 1];
strcpy (mVarStoreName, StoreName);
@@ -1616,6 +1618,7 @@ SVfrVarStorageNode::SVfrVarStorageNode (
mVarStoreType = EFI_VFR_VARSTORE_NAME;
mStorageInfo.mNameSpace.mNameTable = new EFI_VARSTORE_ID[DEFAULT_NAME_TABLE_ITEMS];
mStorageInfo.mNameSpace.mTableSize = 0;
+ mAssignedFlag = FALSE;
}
SVfrVarStorageNode::~SVfrVarStorageNode (
--
2.12.0.windows.1
next prev parent reply other threads:[~2017-12-19 3:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-19 3:28 [PATCH 00/17] BaseTools/C: Code refinements Hao Wu
2017-12-19 3:28 ` [PATCH 01/17] BaseTools/C/Common: Add checks for array access Hao Wu
2017-12-19 3:28 ` [PATCH 02/17] BaseTools/EfiRom: Refine the logic in main() Hao Wu
2017-12-19 3:28 ` [PATCH 03/17] BaseTools/LzmaCompress: Fix possible uninitialized variable Hao Wu
2017-12-19 3:28 ` [PATCH 04/17] BaseTools/C/Common: Remove redundant type cast Hao Wu
2017-12-19 3:29 ` [PATCH 05/17] BaseTools/VfrCompile: Assign 'NULL' for closed file handle Hao Wu
2017-12-19 3:29 ` [PATCH 06/17] BaseTools/GenFv: Add check to ensure the file handle status is correct Hao Wu
2017-12-19 3:29 ` [PATCH 07/17] BaseTools/C/Common: Add/refine boundary checks for strcpy/strcat calls Hao Wu
2017-12-19 3:29 ` [PATCH 08/17] BaseTools/C/Common: Refine using sprintf() with '%s' in format string Hao Wu
2017-12-19 3:29 ` [PATCH 09/17] BaseTools/EfiRom: Add/refine boundary checks for strcpy/strcat calls Hao Wu
2017-12-19 3:29 ` [PATCH 10/17] BaseTools/GenBootSector: Add/refine boundary checks for strcpy/strcat Hao Wu
2017-12-19 3:29 ` [PATCH 11/17] BaseTools/GenFv: Add/refine boundary checks for strcpy/strcat calls Hao Wu
2017-12-19 3:29 ` [PATCH 12/17] BaseTools/GenVtf: " Hao Wu
2017-12-19 3:29 ` [PATCH 13/17] BaseTools/VfrCompile: Add/refine boundary checks for strcpy/strcat Hao Wu
2017-12-19 3:29 ` Hao Wu [this message]
2017-12-19 3:29 ` [PATCH 15/17] BaseTools/GenFfs: Enlarge the size of 'AlignmentBuffer' Hao Wu
2017-12-19 3:29 ` [PATCH 16/17] BaseTools/GenSec: Fix potential memory leak Hao Wu
2017-12-19 3:29 ` [PATCH 17/17] BaseTools/GenSec: Fix potential null pointer dereference Hao Wu
2017-12-25 1:48 ` [PATCH 00/17] BaseTools/C: Code refinements Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171219032912.14404-15-hao.a.wu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox