Below is a copy of a bug report I just submitted at xfree86.org and
bugs.opera.com:
-----

Xutf8TextPropertyToTextList causes applications to segfault on Opera's
(7.11) _NET_WM_NAME property. Opera seems to have a terminating 0x00
in the string while e.g. Mozilla doesn't. I'm not sure if such a
terminating character is allowed, but certainly Xlib shouldn't cause a
segfault in such a case.

The problem was discovered when starting Opera crashed my Ion window
manager with UTF8 support enabled, but the following code also segfaults
after printing prop.value when argv[1] contains the window ID of an
Opera window (gotten with e.g. xwininfo). Setting prop.nitems to
strlen(prop.value) before the call removes the problem, but is not really
a solution.

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdio.h>

int main(int argc, char*argv[])
{
        Display *dpy;
        Atom a;
        XTextProperty prop;
        char **list=NULL;
        int n=0;
        
        dpy=XOpenDisplay(NULL);
        
        a=XInternAtom(dpy, "_NET_WM_NAME", False);
        
        if(XGetTextProperty(dpy, strtoul(argv[1], NULL, 16), &prop, a)){
                printf("%s\n", prop.value);
                Xutf8TextPropertyToTextList(dpy, &prop, &list, &n);
        }
}

The the problem has been witnessed in XFree86 4.2.1.1 and 4.3.0.

-- 
Tuomo

Reply via email to