Re: Endless loop in split_on_bdry() of library/parser_multipart.c?

Joe Schaefer <[email protected]>
Newsgroups gmane.comp.apache.apreq
Message-ID <[email protected]>
Bojan Smojver <[email protected]> writes:

> Quoting Joe Schaefer <[email protected]>:
>
>> This is the right approach, I think.  But the person who'd be
>> in the best place to test/commit it is Bojan.  Just be sure
>> to bump the patch level in apreq_version.h, and add a comment
>> to CHANGES.
>
> This code hangs the test (Joe Orton's original suggestion):
>
> -------------------------------
>             do {
>                 apr_bucket *f = APR_RING_FIRST(&in->list);
>                 apr_bucket *l = APR_RING_LAST(&in->list);
>                 APR_RING_UNSPLICE(f, l, link);
>                 APR_RING_SPLICE_TAIL(&out->list, f, l, apr_bucket, link);
>             } while (e != APR_BRIGADE_FIRST(in));
> -------------------------------
>
> This code also hangs the test (Joe Schaefer's subsequent suggestion):
>
> -------------------------------
>             do {
>                 apr_bucket *f = APR_RING_FIRST(&in->list);
>                 apr_bucket *l = APR_BUCKET_PREV(e);
>                 APR_RING_UNSPLICE(f, l, link);
>                 APR_RING_SPLICE_TAIL(&out->list, f, l, apr_bucket, link);
>             } while (e != APR_BRIGADE_FIRST(in));
> -------------------------------
>
> When compiled with -fno-strict-aliasing, Joe Schaefer's suggestion
> passes the test, Joe Orton's suggestion hangs the test.
>
> Or maybe I misunderstood what the code should actually be?


do { ... } while (0) is better- it's no longer a loop.
What is the assembler now?

-- 
Joe Schaefer
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.