Nmap Development mailing list archives
Re: nmap 3.3+V-2.99
From: "Jay Freeman \(saurik\)" <saurik () saurik com>
Date: Sun, 31 Aug 2003 19:48:26 -0500
Brett:
Counted_ is defined to be a pointer. The only two expansions are:
template <typename Counted_>
class ReferenceManager :
public NullReferenceHelper<Counted_ *>
{
public:
// XXX: stupid gcc 3.2.2
typedef typename NullReferenceHelper<Counted_ *>::Value Value;
This is a backend function of a massively generalized smart pointer class.
The particular implementation of Clear being looked at is defined in a
helper class that reference count managers that are managing pointers are
encouraged to derive from for easier implementation. If you needed a smart
pointer that worked over something else (maybe more smart pointers, maybe
the windows HANDLE sysem, etc.) then you could implement your own version of
Clear() that resets the value to a cleared state. In this case, simply
setting it to NULL works.
Your point about the callers being broken is what seems would have to be the
case considering A) if it weren't something you could assign NULL to it
wouldn't compile and B) assigning NULL to something that can be assigned
NULL to wouldn't crash except if your reference to that object was invald
and then reading the reference (such as Gisle's patch does) would also cause
the same crash (well, unless the reference you have is in read only memory
or something and also happens to be set to 0s, but I have hardly ever seen
readonly memory used...).
If you are curious to see the file:
Syntax Highlighted:
http://www.jayfreeman.com/cartouche/svn.saurik.com/repos/menes/!svn/ver/244/
trunk/menes-ext/refcount.hpp
Not-So Syntax Highlighted:
http://svn.saurik.com/repos/menes/trunk/menes-ext/refcount.hpp
I'll try to look into it more. This code _is_ stressed a lot, I use this
system as the base for a number of different handle implementations that are
used in our 3D engine at Gnostic Labs (for everything from COM to our video
texture manager).
Oh, seeing as I'm sending an extra e-mail anyway: to people who are using
that 2.96 fix I posted, it's slightly wrong. It won't harm anything, but
will cause nmap to use more CPU than it should. That should be
maxRttTimeout() or whatever _times 1000_. I tried the incorrect on myself on
2.96 before posting that and it didn't cause nmap to be any slower so I
didn't consider it important enough to send a correction e-mail all by
itself for that (nmap+V is fundamentally not CPU limited with even somewhat
crazy parallism values so it doesn't noticeably affect the speed).
Sincerely,
Jay Freeman (saurik)
saurik () saurik com
----- Original Message -----
From: "Brett Hutley" <brett () hutley net>
To: <nmap-dev () insecure org>
Sent: Sunday, August 31, 2003 6:42 PM
Subject: Re: nmap 3.3+V-2.99
...
So the test should be done *before* calling the Clear function if you want to keep the pass by reference semantics. (Note that I haven't got refcount.hpp in the version of nmap I built, so I could be completely off-base here if Counted_ is actually defined to be a pointer in the first place). -- Brett Hutley [MAppFin,CISSP,SANS GCIH] mailto:brett () hutley net http://hutley.net/brett
--------------------------------------------------------------------- For help using this (nmap-dev) mailing list, send a blank email to nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).
Current thread:
- nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- <Possible follow-ups>
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Aug 31)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Aug 31)
- Re: nmap 3.3+V-2.99 Brett Hutley (Aug 31)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Aug 31)
- Re: nmap 3.3+V-2.99 Brett Hutley (Aug 31)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Aug 31)
- Re: nmap 3.3+V-2.99 Fyodor (Sep 04)
- Re: nmap 3.3+V-2.99 Gisle Vanem (Sep 04)
- Re: nmap 3.3+V-2.99 Jay Freeman (saurik) (Sep 04)
