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.
From 94bb12f2c1ba22d4d09fce286e4305f8c36e4155 Mon Sep 17 00:00:00 2001
From: Jeremy Sowden <[email protected]>
Date: Tue, 25 Jun 2019 14:01:38 +0100
Subject: [PATCH] If XOpenDisplay return NULL, exit.

---
 platypus/wmcoincoin_player.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/platypus/wmcoincoin_player.c b/platypus/wmcoincoin_player.c
index b11239ad15fa..06cb04bbe93f 100644
--- a/platypus/wmcoincoin_player.c
+++ b/platypus/wmcoincoin_player.c
@@ -104,6 +104,9 @@ main (int argc, char **argv)
    init_anim();
 
    disp  = XOpenDisplay(NULL);
+   if (disp == NULL)
+     return 1;
+
    if (argc == 1) {
      printf("kikou je suis un player pourri\n");
      printf("mes options toutes plus nazes les unes que les autres sont:\n");
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to