apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 56654] apr_skiplist sometimes corrupts
Date Sat, 21 Jun 2014 14:34:33 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=56654

--- Comment #7 from Takashi Sato <takashi.asfbugzilla@tks.st> ---
(In reply to Eric Covener from comment #6)
[cut]
> 
> Did you try your testcase w/ this #if 0 un-ifdeffed out?
> 
> static apr_skiplistnode *insert_compare(apr_skiplist *sl, void *data,
>                                         apr_skiplist_compare comp, int
> replace)
> {
>     apr_skiplistnode *m, *p, *tmp, *ret = NULL, **stack;
>     int nh = 1, ch, stacki;
>     if (!sl->top) {
>         sl->height = 1;
>         sl->topend = sl->bottomend = sl->top = sl->bottom =
>             (apr_skiplistnode *)apr_skiplist_alloc(sl,
> sizeof(apr_skiplistnode));
> #if 0
>         sl->top->next = (apr_skiplistnode *)NULL;
>         sl->top->data = (apr_skiplistnode *)NULL;
>         sl->top->prev = (apr_skiplistnode *)NULL;
>         sl->top->up = (apr_skiplistnode *)NULL;
>         sl->top->down = (apr_skiplistnode *)NULL;
>         sl->top->nextindex = (apr_skiplistnode *)NULL;
>         sl->top->previndex = (apr_skiplistnode *)NULL;
> #endif
>         sl->top->sl = sl;
>     }
> 
> I wonder if there is even any point in skipping a memset call though.

I just tried this, but doesn't remove the issue.
Then, I found another #if 0 block.

    for (; sl->height < nh; sl->height++) {
        sl->top->up =
            (apr_skiplistnode *)apr_skiplist_alloc(sl,
sizeof(apr_skiplistnode));
        sl->top->up->down = sl->top;
        sl->top = sl->topend = sl->top->up;
#if 0
        sl->top->prev = sl->top->next = sl->top->nextindex =
            sl->top->previndex = sl->top->up = NULL;
        sl->top->data = NULL;
#endif
        sl->top->sl = sl;
    }

I removed this and ran my testcode, and seemed like things went well.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message