Zero initialize ch to avoid possible bug - conditions are very subtle.
authorBruce Dawson <brucedawson@google.com>
Mon, 17 Nov 2014 23:22:03 +0000 (15:22 -0800)
committerBruce Dawson <brucedawson@google.com>
Mon, 17 Nov 2014 23:22:03 +0000 (15:22 -0800)
Whether ch and iRet are read without being initialized depends on complex
preconditions and cannot be determined by looking at these function.
Therefore it seems prudent to zero initialize them to avoid any risk.

BUG=427616
R=bo_xu@foxitsoftware.com

Review URL: https://codereview.chromium.org/727083002

core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
core/src/fxcrt/fx_xml_parser.cpp

index fd94b88..4a34de1 100644 (file)
@@ -2084,7 +2084,7 @@ FX_INT32 CPDF_Creator::Continue(IFX_Pause *pPause)
     if (m_iStage < 0) {
         return m_iStage;
     }
-    FX_INT32 iRet;
+    FX_INT32 iRet = 0;
     while (m_iStage < 100) {
         if (m_iStage < 20) {
             iRet = WriteDoc_Stage1(pPause);
index 3608a74..26c6540 100644 (file)
@@ -282,7 +282,7 @@ void CXML_Parser::GetAttrValue(CFX_WideString &value)
         return;
     }
     CFX_UTF8Decoder decoder;
-    FX_BYTE mark = 0, ch;
+    FX_BYTE mark = 0, ch = 0;
     do {
         while (m_dwIndex < m_dwBufferSize) {
             ch = m_pBuffer[m_dwIndex];