You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Graham Leggett <mi...@sharp.fm> on 2006/10/26 21:48:03 UTC

apr_brigade_create() produces a corrupt brigade

Hi all,

I have spent a few hours trying to get to the bottom of this, and and 
truly stuck.

When creating a new brigade inside a filter, I do this:

r = f->r;
dobj->tmpbb = apr_brigade_create(r->pool, r->connection->bucket_alloc);

This runs fine - a brigade is created, containing a single bucket.

The trouble is, the bucket inside the brigade is corrupt - it's name 
consists of random bytes, and the pointers to its methods are either 
NULL or corrupt bytes.

Obviously any attempt to read the contents of this brigade causes a 
segfault, although I can happily add other buckets to this brigade first.

Is there are magic initialisation that needs to be done before a brigade 
creation is possible?

I am using apr-trunk, against httpd-trunk.

Regards,
Graham
--

Re: apr_brigade_create() produces a corrupt brigade

Posted by Davi Arnaut <da...@haxent.com.br>.
Graham Leggett wrote:
> Hi all,
> 
> I have spent a few hours trying to get to the bottom of this, and and 
> truly stuck.
> 
> When creating a new brigade inside a filter, I do this:
> 
> r = f->r;
> dobj->tmpbb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
> 
> This runs fine - a brigade is created, containing a single bucket.

Where/how did you inserted the bucket ? This brigade is empty.

> The trouble is, the bucket inside the brigade is corrupt - it's name 
> consists of random bytes, and the pointers to its methods are either 
> NULL or corrupt bytes.

Are you sure the bucket is there ?

> Obviously any attempt to read the contents of this brigade causes a 
> segfault, although I can happily add other buckets to this brigade first.

Are you sure the brigade is not empty ?

> Is there are magic initialisation that needs to be done before a brigade 
> creation is possible?
> 

As long as the pool and the bucket alloc list are valid, the brigade is
valid.

--
Davi Arnaut