Open Bug 1278494 Opened 8 years ago Updated 2 years ago

(coverity) uninitialized variable, etc.: /mailnews/base/util/nsMsgDBFolder.cpp oldBiffState

Categories

(MailNews Core :: Backend, defect)

defect

Tracking

(Not tracked)

People

(Reporter: ishikawa, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 450412)

Coverity found this.


4574NS_IMETHODIMP nsMsgDBFolder::GetBiffState(uint32_t *aBiffState)
4575{
4576  nsCOMPtr<nsIMsgIncomingServer> server;
4577  nsresult rv = GetServer(getter_AddRefs(server));
4578  NS_ENSURE_SUCCESS(rv, rv);
4579  return server->GetBiffState(aBiffState);
4580}
4581
4582NS_IMETHODIMP nsMsgDBFolder::SetBiffState(uint32_t aBiffState)
4583{
    1. var_decl: Declaring variable oldBiffState without initializer.
4584  uint32_t oldBiffState;
4585  nsCOMPtr<nsIMsgIncomingServer> server;
4586  nsresult rv = GetServer(getter_AddRefs(server));
    2. Condition !!!NS_FAILED_impl(rv), taking false branch
    3. Condition !!!NS_FAILED_impl(rv), taking false branch
    4. Condition (bool)!!!NS_FAILED_impl(rv), taking false branch
4587  if (NS_SUCCEEDED(rv) && server)
    CID 1260187: Unused value (UNUSED_VALUE) [select issue]
4588    rv = server->GetBiffState(&oldBiffState);
4589
    CID 450412 (#1 of 1): Uninitialized scalar variable (UNINIT)5. uninit_use: Using uninitialized value oldBiffState.
4590  if (oldBiffState != aBiffState)
4591  {
4592    // Get the server and notify it and not inbox.
4593    if (!mIsServer)
4594    {

That is when there are some errors on 4586, we don't set the value for oldBiffState which is subsequently referenced.

We ought to set the initialization value somehow.
(I wonder, though, if the error case happens, and if it does, we may want to at least warn the user, correct?).
Component: General → Backend
Product: Thunderbird → MailNews Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.