[SERVER-3285] Dead Assignment/Variable added in commit 884e100 (also a NULL dereference bug) Created: 17/Jun/11  Updated: 12/Jul/16  Resolved: 23/Jun/11

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: None
Fix Version/s: 1.9.1

Type: Bug Priority: Minor - P4
Reporter: Chris Wilson Assignee: Kristina Chodorow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File 0001-Remove-a-dead-assignment-of-wasMaster.patch     File 0002-Fix-a-possible-null-dereference-of-targetHost.patch    
Operating System: ALL
Participants:

 Description   

Hi,

We are using Sentry (a C/C++ static analysis tool) to analyze
mongodb on a nightly basis. Sentry found that a dead assignment
was recently introduced in the commit 884e100.

While reviewing that issue, I also noticed a potential NULL
dereference that Sentry found.

I've provided a patch for each issue.

I can see from the code that the dead assignment was at one point a
debugging variable. However, the assert was commented out, and thought
it might be nice to clean up the code. If this isn't the case, please disregard this patch.

The NULL dereference could be a potentially serious bug if targetHost can be NULL
when entering the function.

I'm not sure either of these patches are the correct patch considering I don't know
the code that well, hopefully you can investigate.

Thanks,
Chris


Chris Wilson
http://vigilantsw.com/
Vigilant Software, A C/C++ Static Analysis Company



 Comments   
Comment by Kristina Chodorow (Inactive) [ 23/Jun/11 ]

Thanks, merged!

Comment by auto [ 23/Jun/11 ]

Author:

{u'login': u'kchodorow', u'name': u'Kristina', u'email': u'kristina@10gen.com'}

Message: fix null deref SERVER-3285

Patch by Mike Mueller
Branch: master
https://github.com/mongodb/mongo/commit/8a3a9eb50150dc35fcff41f8fd1e7a2763795c1c

Comment by Mike Mueller [ 23/Jun/11 ]

Hi Kristina, I've gone ahead and signed the agreement on behalf of Vigilant. Thanks!

Comment by Kristina Chodorow (Inactive) [ 20/Jun/11 ]

Thanks for the patches! Can you sign the contributor's agreement so that I can merge in the null dereference one? http://10gen-corp.appspot.com/contributor

Comment by Chris Wilson [ 18/Jun/11 ]

Looks like the dead assign was updated in this patch,
https://github.com/mongodb/mongo/commit/3eb1de47f1d19d96ae9facba2afd7e499f90cb7e
I guess the developers like it.

Please still look at the null dereference issue.

Generated at Thu Feb 08 03:02:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.