Control: forwarded -1 https://github.com/dinhviethoa/libetpan/issues/145

  Hi Steven,

On Fri, Jun 13, 2014 at 12:11:06AM +1000, Steven McDonald wrote:
> Package: libetpan17
> Version: 1.5-1
> Severity: important
> Tags: upstream patch
> 
> Hi there,
> 
> Claws Mail (all versions since 3.9.3-2+b3, inclusive) reliably
> segfaults seconds after startup on my system. I have attached a full
> backtrace taken after such an event.
> 
> I have tracked the problem down to a corner case in the interaction
> between claws-mail and libetpan17, which seems simplest to fix in
> libetpan. The trigger for the bug is that claws-mail links directly
> against libgnutls26, but also against libetpan17, which links against
> libgnutls-deb0-28.

  This has been corrected in claws-mail/3.10.1-2 and libetpan/1.5-1 and
should fix the issue without patching. Can you upgrade and check?

> This problem does not occur with versions of claws-mail prior to
> 3.9.3-2+b3, which all link against libetpan16 (which links against
> libgnutls26).
> 
> claws-mail first calls gnutls_global_init, which initialises
> libgnutls26, and then calls mailstream_gnutls_init_not_required in
> libetpan17, which causes libetpan not to initialise libgnutls-deb0-28.
> The result of this is that libetpan calls gnutls with an uninitialised
> session handle, resulting in a segfault.
> 
> However, since gnutls_global_init is reentrant, it is perfectly safe to
> ignore any calls to mailstream_gnutls_init_not_required and initialise
> gnutls anyway. In the case where gnutls has already been initialised,
> doing so will simply increment a counter; and in the case where this
> bug is triggered, gnutls will be properly initialised before use.
> 
> OpenSSL's SSL_library_init is not reentrant, and therefore this change
> can only apply to gnutls.
> 
> I am attaching a patch which implements this change, and I have
> confirmed that it fixes the segfaulting behaviour described above.
> Please let me know if you think it needs to be revised, or if you need
> any further information.

  Thanks for the detailed analysis! I'm forwarding this upstream to see
if it's worth to add it, although seems good to me :)

  best regards,
-- 
  Ricardo Mones 
  ~
  Never send a human to do a machine's job.               Agent Smith

Attachment: signature.asc
Description: Digital signature

Reply via email to