Bug#716463: Patch

Jeremy Sowden jeremy at azazel.net
Tue Jun 25 14:13:04 BST 2019


This crash involves calling /usr/lib/wmcoincoin/wmcoincoin_player
directly with an empty environment.  Under those circumstances
XOpenDisplay returns NULL:

   disp  = XOpenDisplay(NULL);

   if (argc == 1) {
     printf("kikou je suis un player pourri\n");
     printf("mes options toutes plus nazes les unes que les autres sont:\n");
     printf(" wmcoincoin_player uneimage        pour voir une image\n");
     printf(" wmcoincoin_player -z unchiffre uneimage  pour voir une image avec un certain facteur de zoom\n");
     printf(" wmcoincoin_player -i uneimage     pour connaitres les dimensions d'une image\n");
     printf(" wmcoincoin_player -s uneimage     le stack-mode (pour debeuggai)\n");
     printf(" le dernier argument, optionel, est l'id de la fenetre a utiliser\n");
     exit(0);
   }
   if (argc >= 3 && strcmp(argv[1], "-i") == 0) {
     query_mode = 1;
     argc--; argv++;
   }
   if (argc >= 3 && strcmp(argv[1], "-s") == 0) {
     stack_mode = 1;
     argc--; argv++;
   }
   if (argc >= 3 && strcmp(argv[1], "-z") == 0) {
     prefs.zoom = atof(argv[2]);
     argc-=2; argv += 2;
   }
   if (argc == 2) {
     fname  = argv[1];
     if (!query_mode) {
       vis   = DefaultVisual(disp, DefaultScreen(disp));
       depth = DefaultDepth(disp, DefaultScreen(disp));
       cm    = DefaultColormap(disp, DefaultScreen(disp));
       win   = XCreateSimpleWindow(disp, DefaultRootWindow(disp), 0, 0, 10, 10,
                                   0, 0, 0);
       XSelectInput(disp, win, ButtonPressMask | ButtonReleaseMask |
                    ButtonMotionMask | PointerMotionMask);
     }
   } else {
     XWindowAttributes attr;
     unsigned long lwin;
     sscanf(argv[2],"0x%lx",&lwin); win = lwin;
     //printf("win=%08lx\n", lwin);
     fname = argv[1];

which leads to a NULL-pointer being passed to XGetWindowAttributes:

     XGetWindowAttributes(disp, win, &attr);
     vis = attr.visual;
     depth = attr.depth;
     cm = attr.colormap;
   }

However, wmcoincoin_player is not supposed to be run like this.  It is
intended to be execked by wmcoincoin once the application is up and
running, which implies that the environment is correctly set up.

I've attached a fix.

J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-If-XOpenDisplay-return-NULL-exit.patch
Type: text/x-diff
Size: 763 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-wmaker-devel/attachments/20190625/ba8d2236/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-wmaker-devel/attachments/20190625/ba8d2236/attachment.sig>


More information about the Pkg-wmaker-devel mailing list