Is this a bug?
Moderator: Moderator Team
Is this a bug?
I confused with this code:
LONG
FASTCALL
ObDereferenceObjectEx(IN PVOID Object,
IN LONG Count)
{
POBJECT_HEADER Header;
LONG NewCount;
/* Extract the object header */
Header = OBJECT_TO_OBJECT_HEADER(Object);
/* Check whether the object can now be deleted. */
NewCount = InterlockedExchangeAdd(&Header->PointerCount, -Count);
if (!Count) ObpDeferObjectDeletion(Header);
/* Return the current count */
return NewCount;
}
Is this should be NewCount?
LONG
FASTCALL
ObDereferenceObjectEx(IN PVOID Object,
IN LONG Count)
{
POBJECT_HEADER Header;
LONG NewCount;
/* Extract the object header */
Header = OBJECT_TO_OBJECT_HEADER(Object);
/* Check whether the object can now be deleted. */
NewCount = InterlockedExchangeAdd(&Header->PointerCount, -Count);
if (!Count) ObpDeferObjectDeletion(Header);
/* Return the current count */
return NewCount;
}
Is this should be NewCount?
Re: Is this a bug?
Actually you could say theres 3 bugs, since count could be greater then PointerCount resulting in negative PointerCount which would still need to get it deleted, but with the current code (even if you replace Count with header->pointercount) wouldn't do so.
Re: Is this a bug?
If you would like to give a name, credit should be given in commit.
mjmartin
mjmartin
Re: Is this a bug?
Can we change to :
if ((NewCount - Count)<=0) ObpDeferObjectDeletion(Header);
if ((NewCount - Count)<=0) ObpDeferObjectDeletion(Header);
-
- Test Team
- Posts: 802
- Joined: Thu Apr 03, 2008 2:17 pm
- Contact:
Re: Is this a bug?
If you ever spot more bugs in future, join us at Freenode IRC, #reactos. The dev team hangs out there and can entertain your queries quicker.
Re: Is this a bug?
Thanks, I fixed this and other related bugs in r41043.
-
- Posts: 242
- Joined: Mon Jun 16, 2008 6:51 pm
Re: Is this a bug?
Nice to see this bug fixed 

Who is online
Users browsing this forum: Semrush [Bot] and 4 guests