Skip to content

Client reference count error#684

Open
hellothere-yan wants to merge 7 commits intoLibVNC:masterfrom
hellothere-yan:master
Open

Client reference count error#684
hellothere-yan wants to merge 7 commits intoLibVNC:masterfrom
hellothere-yan:master

Conversation

@hellothere-yan
Copy link

…rn. rfbClientIteratorNext decrements the reference of the current node and increments the next one. However, rfbClientIteratorHead was only performing a decrement on the existing i->next, but not performing an increment when setting the new i->next from screen->clientHead.


This led to a negative refCount (e.g., -1, -2, -3) because the subsequent call to rfbClientIteratorNext in rfbProcessEvents would attempt to decrement a reference that was never legally "taken."

rfbProcessEvents
cl = rfbClientIteratorHead(i) ----i->next=i->screen->clientHead;
while(cl)
{
cl=rfbClientIteratorNext(i); -----i->next !=0 ----->rfbDecrClientRef(cl);
}

14067 added 7 commits December 31, 2025 10:56
…rn. rfbClientIteratorNext decrements the reference of the current node and increments the next one. However, rfbClientIteratorHead was only performing a decrement on the existing i->next, but not performing an increment when setting the new i->next from screen->clientHead.


This led to a negative refCount (e.g., -1, -2, -3) because the subsequent call to rfbClientIteratorNext in rfbProcessEvents would attempt to decrement a reference that was never legally "taken."

rfbProcessEvents
cl = rfbClientIteratorHead(i)   ----i->next=i->screen->clientHead;
while(cl)
{
	cl=rfbClientIteratorNext(i);   -----i->next !=0 ----->rfbDecrClientRef(cl);
}

Signed-off-by: 14067 <yanzt@sugon.com>
…rn. rfbClientIteratorNext decrements the reference of the current node and increments the next one. However, rfbClientIteratorHead was only performing a decrement on the existing i->next, but not performing an increment when setting the new i->next from screen->clientHead.


This led to a negative refCount (e.g., -1, -2, -3) because the subsequent call to rfbClientIteratorNext in rfbProcessEvents would attempt to decrement a reference that was never legally "taken."

rfbProcessEvents
cl = rfbClientIteratorHead(i)   ----i->next=i->screen->clientHead;
while(cl)
{
	cl=rfbClientIteratorNext(i);   -----i->next !=0 ----->rfbDecrClientRef(cl);
}

Signed-off-by: 14067 <yanzt@sugon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant