hlcache_handle_get_content assert is need ?

Bernd Roesch nospamname at gmx.de
Tue Jun 29 20:47:30 BST 2010


Hello John-Mark

On 28.06.10, you wrote:

> On Mon, 2010-06-28 at 10:53 +0200, Bernd Roesch wrote:
>> Hi, 
>> 
>> A user report when he log in to www.netmail.nl (it use https but the start page work) to get
>> mails
>> 
>> he get this error
>> 
>> content/hlcache.c:257: failed assertion `handle != NULL'
>> Abort trap - Netsurf 
> 
> You'll have to provide a full backtrace before anyone can debug this.

thats hard, because its not my computer.

But the problem of the arstechnica.com load i get is in the same Function but little diffrent,  it
happen always on my system when debug too.netsurf without cache have not the problem.

here it happen that the structure 

struct hlcache_handle {
    hlcache_entry *entry;       /**< Pointer to cache entry */

    hlcache_handle_callback cb; /**< Client callback */
    void *pw;           /**< Client data */
};

contain 0 as entry value.All other datas are here.
I also do not notice what code do the entry value set.

I find this notice in source, so maybe its possible that there is some timing issue

---------------------

nserror hlcache_handle_abort(hlcache_handle *handle)
{
    struct hlcache_entry *entry = handle->entry;
    struct content *c;

if (entry == NULL) {
        /* This handle is not yet associated with a cache entry.
         * The implication is that the fetch for the handle has
         * not progressed to the point where the entry can be
         * created. */ 

------------------------------------------------------------------

the code that want access the cache event is this but 

sheet = s-> data.css.sheet;

do crap because

s = 0 

In html.c here the cache access is do.

void html_finish_conversion(struct content *c)
{
    union content_msg_data msg_data;
    xmlNode *html;
    uint32_t i;
    css_error error;

    html = xmlDocGetRootElement(c->data.html.document);
    assert(html != NULL);

    /* check that the base stylesheet loaded; layout fails without it */
    if (c->data.html.stylesheets[STYLESHEET_BASE].data.external == NULL) {
        msg_data.error = "Base stylesheet failed to load";
        content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
        c->status = CONTENT_STATUS_ERROR;
        return;
    }

    /* Create selection context */
    error = css_select_ctx_create(ns_realloc, c, &c->data.html.select_ctx);
    if (error != CSS_OK) {
        msg_data.error = messages_get("NoMemory");
        content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
        c->status = CONTENT_MSG_ERROR;
        return;
    }

    /* Add sheets to it */
    for (i = STYLESHEET_BASE; i != c->data.html.stylesheet_count; i++) {
        const struct html_stylesheet *hsheet =
                &c->data.html.stylesheets[i];
        css_stylesheet *sheet;
        css_origin origin = CSS_ORIGIN_AUTHOR;

        if (i < STYLESHEET_START)
            origin = CSS_ORIGIN_UA;

        if (hsheet->type == HTML_STYLESHEET_EXTERNAL &&
                hsheet->data.external != NULL) {
            struct content *s = hlcache_handle_get_content(
                    hsheet->data.external);

------>            sheet = s-> data.css.sheet;

---------------------------------

but the real fail come only later in the func xml_to_box

and in box_construct.c

partial = nscss_get_style(c, n, CSS_PSEUDO_ELEMENT_NONE,
                  CSS_MEDIA_SCREEN, inline_style,
                  box_style_alloc, NULL);

partial get 0

and netsurf do out of memory massage output(i have 200 megabyte free ) and do not continue to load
the page.
libcurl that is used is 7.21.0



> 
>> Netsurf is compile with assert check enable, but the function look 0 value safe and return 0,
>> when no handle is here.
>> 
>> Is it possible to remove the assert and output only a warning message instead ?
> 
> Absolutely not. That assertion is there for a reason: it is a bug to
> call that function with a NULL pointer.
> 

ok

> 
> J.
> 
Regards




More information about the netsurf-dev mailing list