Changeset 1905


Ignore:
Timestamp:
Apr 2, 2008 6:36:35 PM (11 years ago)
Author:
bennylp
Message:

Ticket #520: Race condition may cause ioqueue corruption (thanks Philippe Leuba)

Location:
pjproject/trunk/pjlib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/list_i.h

    r1405 r1905  
    7676{ 
    7777    pj_link_node( ((pj_list*)node)->prev, ((pj_list*)node)->next); 
     78 
     79    /* It'll be safer to init the next/prev fields to itself, to 
     80     * prevent multiple erase() from corrupting the list. See 
     81     * ticket #520 for one sample bug. 
     82     */ 
     83    pj_list_init(node); 
    7884} 
    7985 
  • pjproject/trunk/pjlib/src/pj/ioqueue_select.c

    r1868 r1905  
    446446    pj_assert(ioqueue->count > 0); 
    447447    --ioqueue->count; 
     448#if !PJ_IOQUEUE_HAS_SAFE_UNREG 
     449    /* Ticket #520, key will be erased more than once */ 
    448450    pj_list_erase(key); 
     451#endif 
    449452    PJ_FD_CLR(key->fd, &ioqueue->rfdset); 
    450453    PJ_FD_CLR(key->fd, &ioqueue->wfdset); 
Note: See TracChangeset for help on using the changeset viewer.