otrv4 / pidgin-otrng

Fork of https://bugs.otr.im/plugins/pidgin-otr. This is a mirror of https://bugs.otr.im/otrv4/pidgin-otrng
GNU General Public License v2.0
16 stars 5 forks source link

Crash when ending conversation #109

Closed claucece closed 5 years ago

claucece commented 5 years ago

This is related with #57 , but not the same. Even when Alice ends her conversation but Bob does not, eventually the plugin crashes (even when Bob does no action)

pedropalau commented 5 years ago

I realize that this happens mainly when you are using the prekey-server-docker-compose, maybe because of the issues with the permissions or something else.

I recently used some accounts from the jabber.otr.im server and this does not happen.

pedropalau commented 5 years ago

This is one of error that appears when Alice request private conversation with Bob:

pidgin: client.c:826: otrng_client_get_client_profile: Assertion `client->client_profile != NULL' failed.
Aborted (core dumped)
claucece commented 5 years ago

Ohh! @peterpalau ... can we pair tomorrow to check this?

pedropalau commented 5 years ago

@claucece of course we can

MauroVelasco commented 5 years ago

Hi @claucece, I notice this line: conv->conn as the culprit ;), looks like conn contains an invalid memory address. This is invoked in (libotr-ng/client.c):

expiration_time = get_session_expiry_time_from(conv->conn);

I added a validation in order to avoid this behavior:

`if( conv!=NULL && conv->conn!=NULL ){

    expiration_time = get_session_expiry_time_from(conv->conn);

    if (conv->conn->keys->last_generated < now - expiration_time) {

      otrng_client_expire_session(conv);

    }

}`

Although conv->conn is still producing the segmentation fault.

claucece commented 5 years ago

Thanks @MauroVelasco !

What I did to fix it is:

  for (el = client->conversations; el; el = el->next) {
    if (!conv) {
      return;
    }
      conv = el->data;
    expiration_time = get_session_expiry_time_from(conv->conn);
    if (conv->conn->keys->last_generated < now - expiration_time) {
      otrng_client_expire_session(conv);
    }
  }
MauroVelasco commented 5 years ago

Hi @claucece , this, Did you uploaded, to test it?

MauroVelasco commented 5 years ago

Hi @claucece, I did the modification in client.c and testing.

claucece commented 5 years ago

@MauroVelasco No, I did not upload hahaha.. Did you test it? Did it work?

MauroVelasco commented 5 years ago

Hi @claucece, yes I did the change as suggested, don't have the issue until now, let you know if the issue comes again.

claucece commented 5 years ago

woo!!! awesome! @MauroVelasco .. should we close it?

MauroVelasco commented 5 years ago

Hi @claucece, I think so, I was unable to replicate the issue after the modification.

claucece commented 5 years ago

Awesome! Closing it! <3

claucece commented 5 years ago

I did not realized that the change is not pushed ahhaha.. want to push @MauroVelasco ?

MauroVelasco commented 5 years ago

hi @claucece, yeah, sure I'll in minutes

MauroVelasco commented 5 years ago

Hi @claucece, it's uploaded