Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Purify detected some uninitialized memory reads in Prof-UIS Collapse All
Subject Author Date
Kevin Eshbach May 23, 2008 - 8:35 AM

I was running an application that uses Prof-UIS looking for any memory leaks or memory corruption and discoved that Purify was detecting a few Uninitialized Memory Reads in your code.  I looked at the source code and they appear to be legit.  Can you take a look at them and confirm they are legit and if so fix them in a future release of Prof-UIS.


 


[W] UMR: Uninitialized memory read in CExtPopupMenuWnd::TrackFlagsGet(void)const {1 occurrence}     Reading 1 byte from 0x372b4048 (1 byte at 0x372b4048 uninitialized)     Address 0x372b4048 is 632 bytes into a 4316 byte block at 0x372b3dd0     Address 0x372b4048 points to a malloc’d block in heap 0x0d400000     Thread ID: 0x20fc     Error location     CExtPopupMenuWnd::TrackFlagsGet(void)const [extpopupmenuwnd.cpp:13198]     DWORD CExtPopupMenuWnd::TrackFlagsGet() const     {     ASSERT_VALID( this ); => if( ! m_bTopLevel )     return (m_dwTrackFlags&(~(TPMX_RIBBON_FILE_MENU)));     return m_dwTrackFlags;     }     CExtPopupMenuWnd::_IsRibbonMode(void)const [extpopupmenuwnd.cpp:20097]         bool CExtPopupMenuWnd::_IsRibbonMode() const     { => DWORD dwTrackFlags = TrackFlagsGet();     if( dwTrackFlags & TPMX_RIBBON_MODE )     return true;     if( m_pWndParentMenu != NULL )     CExtPopupMenuWnd::_AdjustAnimation(e_animation_type_t::CExtPopupBaseWnd&) [extpopupmenuwnd.cpp:4978]     )     {     ASSERT_VALID( this ); => if( _IsRibbonMode() )     eAT = __AT_CONTENT_DISPLAY;     }         CExtPopupBaseWnd::_InitAnimation(void) [extpopupmenuwnd.cpp:5041]         m_nAnimPercent = m_nAnimPercentOld = 0;     => _AdjustAnimation( m_AnimationType );         if(     (    m_AnimationType < 0     ||    m_AnimationType > __AT_MAX_VALID_VALUE     CExtPopupMenuWnd::_Init(void) [extpopupmenuwnd.cpp:8090]     {     ASSERT_VALID( this );

=> _InitAnimation();

    m_nDyScrollOffset = 0;     m_bTopLevel     CExtPopupMenuWnd::CExtPopupMenuWnd(void) [extpopupmenuwnd.cpp:7970]     , m_bCanceling( false )     {     __VPC_INC; => _Init();     g_ListDetached.AddTail( this );     }


 


[W] UMR: Uninitialized memory read in CExtPopupMenuWnd::TrackFlagsGet(void)const {1 occurrence}     Reading 4 bytes from 0x372b4050 (4 bytes at 0x372b4050 uninitialized)     Address 0x372b4050 is 640 bytes into a 4316 byte block at 0x372b3dd0     Address 0x372b4050 points to a malloc’d block in heap 0x0d400000     Thread ID: 0x20fc     Error location     CExtPopupMenuWnd::TrackFlagsGet(void)const [extpopupmenuwnd.cpp:13200]     ASSERT_VALID( this );     if( ! m_bTopLevel )     return (m_dwTrackFlags&(~(TPMX_RIBBON_FILE_MENU))); => return m_dwTrackFlags;     }         void CExtPopupMenuWnd::TrackFlagsSet(     CExtPopupMenuWnd::_IsRibbonMode(void)const [extpopupmenuwnd.cpp:20097]         bool CExtPopupMenuWnd::_IsRibbonMode() const     { => DWORD dwTrackFlags = TrackFlagsGet();     if( dwTrackFlags & TPMX_RIBBON_MODE )     return true;     if( m_pWndParentMenu != NULL )     CExtPopupMenuWnd::_AdjustAnimation(e_animation_type_t::CExtPopupBaseWnd&) [extpopupmenuwnd.cpp:4978]     )     {     ASSERT_VALID( this ); => if( _IsRibbonMode() )     eAT = __AT_CONTENT_DISPLAY;     }         CExtPopupBaseWnd::_InitAnimation(void) [extpopupmenuwnd.cpp:5041]         m_nAnimPercent = m_nAnimPercentOld = 0;     => _AdjustAnimation( m_AnimationType );

    if(     (    m_AnimationType < 0     ||    m_AnimationType > __AT_MAX_VALID_VALUE     CExtPopupMenuWnd::_Init(void) [extpopupmenuwnd.cpp:8090]     {     ASSERT_VALID( this );     => _InitAnimation();         m_nDyScrollOffset = 0;     m_bTopLevel     CExtPopupMenuWnd::CExtPopupMenuWnd(void) [extpopupmenuwnd.cpp:7970]     , m_bCanceling( false )     {     __VPC_INC; => _Init();     g_ListDetached.AddTail( this );     }


 


[W] UMR: Uninitialized memory read in CExtPopupMenuWnd::_EndAnimation(void) {2 occurrences}     Reading 1 byte from 0x372b4e78 (1 byte at 0x372b4e78 uninitialized)     Address 0x372b4e78 is 4264 bytes into a 4316 byte block at 0x372b3dd0     Address 0x372b4e78 points to a malloc’d block in heap 0x0d400000     Thread ID: 0x20fc     Error location     CExtPopupMenuWnd::_EndAnimation(void) [extpopupmenuwnd.cpp:20049]     {     if(     m_bHelperReCreateDynamicShadowAtTheEndOfNearestAnimation     &&    m_ctrlShadow.GetSafeHwnd() != NULL => )     m_ctrlShadow.DestroyWindow();     m_bHelperReCreateDynamicShadowAtTheEndOfNearestAnimation = false;     if( m_ctrlShadow.GetSafeHwnd() == NULL )     CExtPopupBaseWnd::OnTimer(UINT) [extpopupmenuwnd.cpp:6137]     if( GetSafeHwnd() != NULL )     {     if( m_bAnimFinished ) => _EndAnimation();     else     {     Invalidate( FALSE );     CExtPopupMenuWnd::OnTimer(UINT) [extpopupmenuwnd.cpp:16905]     return;

    default: => CExtPopupBaseWnd::OnTimer(nIDEvent);     break; // default     } // switch( nIDEvent )     }

Technical Support May 23, 2008 - 2:01 PM

Thank you for reporting this problem. You can fix it by updating the following method:

void CExtPopupMenuWnd::_Init()
{
      ASSERT_VALID( this );

      m_nDyScrollOffset = 0;
      m_bTopLevel
            = m_bScrollingAvailable
            = m_bExpandAvailable
            = m_bExpandWasPressed
            = m_bCombineWithEA 
            = m_bSuspendTips
            = false;
      m_dwTrackFlags = 0;
      m_nWaitingExpandTickCount = 0;
      m_nCurIndex
            = m_nDelayedFocusItemIndex
            = m_nLastMousePick
            = IDX_NOTHING;
      m_bDelayedHiding = false;

      m_nScrollingDirection = 0;
      m_rcScrollTop.SetRectEmpty();
      m_rcScrollBottom.SetRectEmpty();
      m_rcExpandBtn.SetRectEmpty();
      m_rcTearOffBtn.SetRectEmpty();
      m_rcRibbonBtnOptions.SetRectEmpty();
      m_rcRibbonBtnExit.SetRectEmpty();

      m_pCbPaintCombinedCookie = NULL;
      m_pCbPaintCombinedContent = NULL;
      m_bCookieIsObject = false;

      _InitAnimation();
}
Please also add the following line to the constructor of the CExtPopupMenuWnd class:
      , m_bHelperReCreateDynamicShadowAtTheEndOfNearestAnimation( false )