Ignore:
Timestamp:
Aug 14, 2009 10:41:00 AM (15 years ago)
Author:
bennylp
Message:

Fixed ticket #939: Throwing exception inside exception handler will cause infinite loop (thanks Roman Puls for the report)

  • exception handler is now popped from the stack immediately in PJ_THROW
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/except.c

    r2394 r2878  
    5151        /* This will crash the system! */ 
    5252    } 
     53    pj_pop_exception_handler_(handler); 
    5354    pj_longjmp(handler->state, exception_id); 
    5455} 
     
    8788} 
    8889 
    89 PJ_DEF(void) pj_pop_exception_handler_(void) 
     90PJ_DEF(void) pj_pop_exception_handler_(struct pj_exception_state_t *rec) 
    9091{ 
    9192    struct pj_exception_state_t *handler; 
     
    9394    handler = (struct pj_exception_state_t *) 
    9495              pj_thread_local_get(thread_local_id); 
    95     pj_assert(handler != NULL); 
    96     pj_thread_local_set(thread_local_id, handler->prev); 
     96    if (handler && handler==rec) { 
     97        pj_thread_local_set(thread_local_id, handler->prev); 
     98    } 
    9799} 
    98100#endif 
Note: See TracChangeset for help on using the changeset viewer.