Changeset 401


Ignore:
Timestamp:
2007-05-29T12:08:18+02:00 (8 years ago)
Author:
moo
Message:

merged [400] from trunk->1.2: fix invalid read of free'ed data for hide-and-seek trick. possible fix version string

Location:
branches/1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2

    • Property svnmerge-integrated changed
      /trunkmerged: 400
  • branches/1.2/xcache.c

    r394 r401  
    9999static zend_bool xc_initized = 0; 
    100100static zend_compile_file_t *origin_compile_file; 
     101static zend_llist_element  *xc_llist_zend_extension; 
    101102 
    102103static zend_bool xc_test = 0; 
     
    24532454} 
    24542455 
     2456static zend_llist_element *xc_llist_get_element_by_zend_extension(zend_llist *l, const char *extension_name) 
     2457{ 
     2458    zend_llist_element *element; 
     2459 
     2460    for (element = zend_extensions.head; element; element = element->next) { 
     2461        zend_extension *extension = (zend_extension *) element->data; 
     2462 
     2463        if (!strcmp(extension->name, extension_name)) { 
     2464            return element; 
     2465        } 
     2466    } 
     2467    return NULL; 
     2468} 
     2469 
     2470static void xc_llist_prepend(zend_llist *l, zend_llist_element *element) 
     2471{ 
     2472    element->next = l->head; 
     2473    element->prev = NULL; 
     2474    if (l->head) { 
     2475        l->head->prev = element; 
     2476    } 
     2477    else { 
     2478        l->tail = element; 
     2479    } 
     2480    l->head = element; 
     2481    ++l->count; 
     2482} 
     2483 
     2484static void xc_llist_unlink(zend_llist *l, zend_llist_element *element) 
     2485{ 
     2486    if ((element)->prev) { 
     2487        (element)->prev->next = (element)->next; 
     2488    } 
     2489    else { 
     2490        (l)->head = (element)->next; 
     2491    } 
     2492 
     2493    if ((element)->next) { 
     2494        (element)->next->prev = (element)->prev; 
     2495    } 
     2496    else { 
     2497        (l)->tail = (element)->prev; 
     2498    } 
     2499 
     2500    --l->count; 
     2501} 
     2502 
    24552503static int xc_zend_extension_startup(zend_extension *extension) 
    24562504{ 
     
    26992747/* }}} */ 
    27002748static startup_func_t xc_last_ext_startup; 
    2701 static zend_llist_element *xc_llist_element; 
    27022749static int xc_zend_startup_last(zend_extension *extension) /* {{{ */ 
    27032750{ 
     
    27092756        } 
    27102757    } 
    2711     xc_zend_extension_register(&zend_extension_entry, 0); 
     2758    assert(xc_llist_zend_extension); 
     2759    xc_llist_prepend(&zend_extensions, xc_llist_zend_extension); 
    27122760    if (!xc_module_gotup) { 
    27132761        return zend_startup_module(&xcache_module_entry); 
     
    27192767{ 
    27202768    xc_zend_extension_gotup = 1; 
    2721     xc_llist_element = NULL; 
    27222769    if (zend_llist_count(&zend_extensions) > 1) { 
    27232770        zend_llist_position lpos; 
    27242771        zend_extension *ext; 
    27252772 
    2726         ext = zend_get_extension(XCACHE_NAME); 
    2727         xc_zend_remove_extension(ext); 
     2773        xc_llist_zend_extension = xc_llist_get_element_by_zend_extension(&zend_extensions, XCACHE_NAME); 
     2774        xc_llist_unlink(&zend_extensions, xc_llist_zend_extension); 
    27282775 
    27292776        ext = (zend_extension *) zend_llist_get_last_ex(&zend_extensions, &lpos); 
    2730         assert(ext); 
     2777        assert(ext && ext != xc_llist_zend_extension); 
    27312778        xc_last_ext_startup = ext->startup; 
    27322779        ext->startup = xc_zend_startup_last; 
Note: See TracChangeset for help on using the changeset viewer.