Closed Bug 506627 Opened 11 years ago Closed 11 years ago

find_dest_id abuses XQueryTree

Categories

(Core :: Plug-ins, defect, critical)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug, )

Details

(Keywords: coverity)

Attachments

(1 file)

3789 static void find_dest_id(XID top, XID *root, XID *dest, int target_x, int target_y)
3790 {
3793   XID *children;
3794   unsigned int nchildren;
3795   while (1) {
3796 loop:
3798     XQueryTree(GDK_DISPLAY(), target_id, root, &parent, &children, &nchildren);

The XQueryTree api only returns valid out values if it returns TRUE, if it returns FALSE, then the out values are undefined.

http://tronche.com/gui/x/xlib/window-information/XQueryTree.html
XQueryTree() returns zero if it fails and nonzero if it succeeds. 

3799     if (nchildren > 0) {
3805         XGetGeometry(GDK_DISPLAY(), children[i], &root, &x, &y,
3806             &width, &height, &border_width,
3807             &depth);

3817           XFree(children);
3818           goto loop;
Attached patch patchSplinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #390907 - Flags: review?(mozbugz)
Attachment #390907 - Flags: review?(mozbugz) → review+
http://hg.mozilla.org/mozilla-central/rev/ac3e57974ee7
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.