Ticket #1610 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Workaround for reported crash on stun_sock's on_data_recvfrom() callback

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-2.1
Component: pjnath Version: trunk
Keywords: Cc:
Backport to 1.x milestone: release-1.16 Backported: yes

Description

Crash has been reported in call to PJ_ERROR below when trying to access stun_sock->obj_name:

stun_sock.c:756:

/* Callback from active socket when incoming packet is received */
static pj_bool_t on_data_recvfrom(pj_activesock_t *asock,
                                  void *data,
                                  pj_size_t size,
                                  const pj_sockaddr_t *src_addr,
                                  int addr_len,
                                  pj_status_t status)
{
    pj_stun_sock *stun_sock;
    pj_stun_msg_hdr *hdr;
    pj_uint16_t type;

    stun_sock = (pj_stun_sock*) pj_activesock_get_user_data(asock);

    /* Log socket error */
    if (status != PJ_SUCCESS) {
        PJ_PERROR(2,(stun_sock->obj_name, status, "recvfrom() error"));
        return PJ_TRUE;
    }

It is suspected that the stun_sock may no longer be valid when the callback is called, possibly because it has been destroyed. A more general synchronization fix is currently being developed, therefore this is considered as a workaround.

Thank you Itay Bianco for the report.

Change History

comment:1 Changed 6 years ago by bennylp

  • Status changed from new to closed
  • Resolution set to fixed

In 4321:

Fixed #1610: Workaround for reported crash on stun_sock's on_data_recvfrom() callback

comment:2 Changed 6 years ago by bennylp

In 4324:

Re #1610: workaround for crash in on_data_sent()

comment:3 Changed 6 years ago by nanang

In 4344:

Re #1610: Workaround for crash in sess_on_send_msg() callback

comment:4 Changed 6 years ago by riza

In 4400:

Re #1610: backported to 1.x

comment:5 Changed 6 years ago by riza

  • Backported set
Note: See TracTickets for help on using tickets.