Closed Bug 154599 Opened 22 years ago Closed 22 years ago

nsLocalMailCopyState::m_lastProgressTime is never initialized

Categories

(MailNews Core :: Backend, defect)

defect
Not set
minor

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 133068

People

(Reporter: dbradley, Assigned: mscott)

Details

Attachments

(1 file)

nsLocalMailCopyState::m_lastProgressTime is never initialized. The impact is
minor,  might miss a status update the first time through. Mainly posting to get
rid of some Purify noise.
QA Contact: gayatri → stephend
I think it should be initialized to PR_Now(), not 0, to avoid us thinking 32
years had passed :-)
I used LL_ZERO instead of PR_Now because I figured it was a good bit cheaper and
I if I read the logic correctly it would just cause it to always update the
status the first time through instead of waiting a half a second. It was also
the same pattern used in other areas of mail/news ->
http://lxr.mozilla.org/seamonkey/source/mailnews/base/src/nsMsgStatusFeedback.cpp#64
Don't know how I missed this, but here's the stack, for future reference
(verification after the fix):

    [W] UMR: Uninitialized memory read in
nsMsgLocalMailFolder::DisplayMoveCopyStatusMsg(void) {1 occurrence}
        Reading 4 bytes from 0x0a153b5c (4 bytes at 0x0a153b5c uninitialized)
        Address 0x0a153b5c is 52 bytes into a 112 byte block at 0x0a153b28
        Address 0x0a153b5c points to a C++ new block in heap 0x02720000
        Thread ID: 0x124
        Error location
        nsMsgLocalMailFolder::DisplayMoveCopyStatusMsg(void)
[nsLocalMailFolder.cpp:3258]
              LL_I2L(nowMS, PR_IntervalToMilliseconds(PR_IntervalNow()));
              LL_SUB(diffSinceLastProgress, nowMS,
mCopyState->m_lastProgressTime); // r = a - b
                  LL_SUB(diffSinceLastProgress, diffSinceLastProgress,
minIntervalBetweenProgress); // r = a - b
         =>       if (!LL_GE_ZERO(diffSinceLastProgress) &&
mCopyState->m_curCopyIndex < mCopyState->m_totalMsgCount)
                    return NS_OK;
            
                  mCopyState->m_lastProgressTime = nowMS;
        nsMsgLocalMailFolder::BeginCopy(nsIMsgDBHdr *) [nsLocalMailFolder.cpp:2315]
        nsCopyMessageStreamListener::OnStartRequest(nsIRequest *,nsISupports *)
[nsCopyMessageStreamListener.cpp:150]
        nsStreamListenerTee::OnStartRequest(nsIRequest *,nsISupports *)
[nsStreamListenerTee.cpp:50]
        nsOnStartRequestEvent0::HandleEvent(void) [nsAsyncStreamListener.cpp:225]
        nsStreamListenerEvent0::HandlePLEvent(PLEvent *)
[nsAsyncStreamListener.cpp:113]
        PL_HandleEvent [plevent.c:596]
        PL_ProcessPendingEvents [plevent.c:526]
        md_EventReceiverProc [plevent.c:1077]
        DestroyWindow  [USER32.dll]
    Allocation location
        new(UINT)      [MSVCRT.DLL]
        nsMsgLocalMailFolder::InitCopyState(nsISupports *,nsISupportsArray
*,int,nsIMsgCopyServiceListener *,nsIMsgWindow *,int,int)
[nsLocalMailFolder.cpp:1636]
        nsMsgLocalMailFolder::CopyMessages(nsIMsgFolder *,nsISupportsArray
*,int,nsIMsgWindow *,nsIMsgCopyServiceListener *,int,int)
[nsLocalMailFolder.cpp:1796]
        nsMsgDBView::CopyMessages(nsIMsgWindow *,UINT *,int,int,nsIMsgFolder *)
[nsMsgDBView.cpp:1958]
        nsMsgDBView::ApplyCommandToIndicesWithFolder(int,UINT *,int,nsIMsgFolder
*) [nsMsgDBView.cpp:1975]
        nsMsgDBView::DoCommandWithFolder(int,nsIMsgFolder *) [nsMsgDBView.cpp:1778]
        XPTC_InvokeByIndex [xptcinvoke.cpp:105]
        XPCWrappedNative::CallMethod(XPCCallContext&,CallMode::XPCWrappedNative)
[xpcwrappednative.cpp:1994]
        XPC_WN_CallMethod(JSContext *,JSObject *,UINT,long *,long *)
[xpcwrappednativejsops.cpp:1266]
        js_Invoke      [jsinterp.c:788]
        js_Interpret   [jsinterp.c:2743]
        js_Invoke      [jsinterp.c:805]
        js_InternalInvoke [jsinterp.c:880]
        JS_CallFunctionValue [jsapi.c:3428]
        nsJSContext::CallEventHandler(void *,void *,UINT,void *,int *,int)
[nsJSEnvironment.cpp:1042]
        nsJSEventListener::HandleEvent(nsIDOMEvent *) [nsJSEventListener.cpp:182]
        nsEventListenerManager::HandleEventSubType(nsListenerStruct
*,nsIDOMEvent *,nsIDOMEventTarget *,UINT,UINT) [nsEventListenerManager.cpp:1221]
        nsEventListenerManager::HandleEvent(nsIPresContext *,nsEvent
*,nsIDOMEvent * *,nsIDOMEventTarget *,UINT,nsEventStatus *)
[nsEventListenerManager.cpp:2218]
        nsXULElement::HandleDOMEvent(nsIPresContext *,nsEvent *,nsIDOMEvent *
*,UINT,nsEventStatus *) [nsXULElement.cpp:3446]
        PresShell::HandleDOMEventWithTarget(nsIContent *,nsEvent *,nsEventStatus
*) [nsPresShell.cpp:6237]
I'm pretty sure these are the same

*** This bug has been marked as a duplicate of 133068 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
verified dup, both are related to local copies.
Status: RESOLVED → VERIFIED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: