Re: [Fwd: Re: apr_brigade_create() produces a corrupt brigade]

2006-10-29 Thread Graham Leggett

Ruediger Pluem wrote:


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


Maybe stupid thought, but isn't this bucket the sentinel and doesn't
APR_BRIGADE_EMPTY return true on this brigade?


There definitely was one bucket in the new empty brigade, and it makes 
sense that this bucket was the sentinel. What didn't make sense though 
was that most of the fields in this bucket were uninitialised, so the 
jump table for code that implements the various bucket methods consisted 
of bogus addresses.


Regards,
Graham
--


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Fwd: Re: apr_brigade_create() produces a corrupt brigade]

2006-10-29 Thread Ruediger Pluem


On 10/29/2006 01:59 PM, Graham Leggett wrote:
 Ruediger Pluem wrote:
 
 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


 Maybe stupid thought, but isn't this bucket the sentinel and doesn't
 APR_BRIGADE_EMPTY return true on this brigade?
 
 
 There definitely was one bucket in the new empty brigade, and it makes
 sense that this bucket was the sentinel. What didn't make sense though
 was that most of the fields in this bucket were uninitialised, so the
 jump table for code that implements the various bucket methods consisted
 of bogus addresses.

Just two curious questions:

1. Did APR_BRIGADE_EMPTY return true on this newly created brigade?
2. Shouldn't the code take care never to process the sentinel because of the
   problems you pointed out above (invalid data, especially in the jump table)?

Regards

RĂ¼diger



Re: [Fwd: Re: apr_brigade_create() produces a corrupt brigade]

2006-10-29 Thread Graham Leggett

Ruediger Pluem wrote:


Just two curious questions:

1. Did APR_BRIGADE_EMPTY return true on this newly created brigade?


No idea, didn't try it.


2. Shouldn't the code take care never to process the sentinel because of the
   problems you pointed out above (invalid data, especially in the jump table)?


Which code, apr or the client code?

In the case of the client code, it shouldn't have to take care about 
anything - if an entry in the jump table is unimplemented for any 
reason, it should be initialised to NULL, and attempts to call those 
methods should return APR_ENOTIMPL.


At the moment, no clean error occurs, as the code falls of the rails and 
eventually crashes randomly later on.


Regards,
Graham
--


smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Fwd: Re: apr_brigade_create() produces a corrupt brigade]

2006-10-29 Thread Ruediger Pluem


On 10/29/2006 03:53 PM, Graham Leggett wrote:
 Ruediger Pluem wrote:
 
 Just two curious questions:

 1. Did APR_BRIGADE_EMPTY return true on this newly created brigade?
 
 
 No idea, didn't try it.
 
 2. Shouldn't the code take care never to process the sentinel because
 of the
problems you pointed out above (invalid data, especially in the
 jump table)?
 
 
 Which code, apr or the client code?

Client code.

 
 In the case of the client code, it shouldn't have to take care about
 anything - if an entry in the jump table is unimplemented for any
 reason, it should be initialised to NULL, and attempts to call those
 methods should return APR_ENOTIMPL.
 
 At the moment, no clean error occurs, as the code falls of the rails and
 eventually crashes randomly later on.

This sounds reasonable. At least this produces reliable error situations in the
case you use the sentinel by error and make things much easier to debug.
Guess that needs to be fixed inside of apr-util.

Regards

RĂ¼diger