<<< Date Index >>>     <<< Thread Index >>>

Re: [1.5.10] bus error when invocation of pgp fails



* Fri Aug 19 2005 Paul Walker <paul@xxxxxxxxxxxxxxxxxxxxx>

> On Fri, Aug 19, 2005 at 01:43:58AM +0200, Christian Ebert wrote:
> 
> > > Message-ID: <20050817050215.GA10117@xxxxxxxxx>
> > BTW I ran it with -F/dev/null; backtrace:
> 
> It looks identical to the other report. Reading the code, there is a path
> which can try to do file operations on a NULL handle if a PGP process can't
> be created. Might be worth checking you have a valid entry for
> pgp_decode_command.
> 
> If you have the spare time, could you try inserting a printf() in the if
> clause at line 341, and also adding:
> 
> #include <assert.h>
>       assert(pgpout != NULL);
> 
> just before line 384 in pgp.c? I'm expecting to see the assert fail. If not,
> I haven't a clue what's going on at this point. :-)

Apparently this bug is introduced at rev 3.50.

http://dev.mutt.org/cgi-bin/viewcvs.cgi/mutt/pgp.c?r1=3.49&r2=3.50&makepatch=1&diff_format=u

2005-08-11 21:08:55  Thomas Roessler  <roessler@xxxxxxxxxxxxxxxxxx>  (roessler)
        * pgp.c: Fix verification of clearsigned PGP messages.
        (debugged on IRC, mostly by Brendan)

I think he just forgot to confirm pgpout!=NULL.

-- 
tamo
--- pgp.c.BAK   Fri Aug 19 12:45:51 2005
+++ pgp.c       Fri Aug 19 12:47:39 2005
@@ -381,16 +381,19 @@ int pgp_application_pgp_handler (BODY *m
        }
        
         /* treat empty result as sign of failure */
-       rewind (pgpout);
-        if ((c = fgetc (pgpout)) == EOF)
+       if (pgpout)
        {
-          mutt_error _("Could not decrypt PGP message");
-          pgp_void_passphrase ();
-          rc = -1;
-          
-          goto out;
-        }
-       ungetc (c, pgpout);
+         rewind (pgpout);
+         if ((c = fgetc (pgpout)) == EOF)
+         {
+           mutt_error _("Could not decrypt PGP message");
+           pgp_void_passphrase ();
+           rc = -1;
+
+           goto out;
+         }
+         ungetc (c, pgpout);
+       }
       }
       
       /*
--- pgp.c~      Fri Aug 12 22:13:30 2005
+++ pgp.c       Fri Aug 19 12:44:03 2005
@@ -378,19 +378,19 @@ int pgp_application_pgp_handler (BODY *m
            
            state_attach_puts (_("[-- End of PGP output --]\n\n"), s);
          }
+
+         /* treat empty result as sign of failure */
+         rewind (pgpout);
+          if ((c = fgetc (pgpout)) == EOF)
+         {
+           mutt_error _("Could not decrypt PGP message");
+           pgp_void_passphrase ();
+           rc = -1;
+
+           goto out;
+         }
+         ungetc (c, pgpout);
        }
-       
-        /* treat empty result as sign of failure */
-       rewind (pgpout);
-        if ((c = fgetc (pgpout)) == EOF)
-       {
-          mutt_error _("Could not decrypt PGP message");
-          pgp_void_passphrase ();
-          rc = -1;
-          
-          goto out;
-        }
-       ungetc (c, pgpout);
       }
       
       /*