Re: [PATCH] Avoid memcpy-from-NULL in apr_brigade_flatten

2023-12-19 Thread Joe Orton
On Mon, Dec 18, 2023 at 04:09:36PM +0100, Ruediger Pluem wrote: > > > On 12/18/23 12:09 PM, Joe Orton wrote: > > On Thu, Dec 14, 2023 at 04:44:47PM -0500, Ben Kallus wrote: > >> memcpy to or from NULL is undefined behavior, even for copies of > >> length 0. See this godbolt link for an example

Re: [PATCH] Avoid memcpy-from-NULL in apr_brigade_flatten

2023-12-18 Thread Ruediger Pluem
On 12/18/23 12:09 PM, Joe Orton wrote: > On Thu, Dec 14, 2023 at 04:44:47PM -0500, Ben Kallus wrote: >> memcpy to or from NULL is undefined behavior, even for copies of >> length 0. See this godbolt link for an example of how this can cause >> problems: https://gcc.godbolt.org/z/zfvnMMsds >> >>

Re: [PATCH] Avoid memcpy-from-NULL in apr_brigade_flatten

2023-12-18 Thread Ben Kallus
> Thanks for the patch, this is an interesting find. Can you say what > bucket type was hit here - e.g. print b->type->name in gdb from inside > apr_brigade_flatten()? Sure thing. It's an EOS bucket. > It looks like metadata bucket types tend to give NULL on read() so I'm > guessing that's the

Re: [PATCH] Avoid memcpy-from-NULL in apr_brigade_flatten

2023-12-18 Thread Joe Orton
On Thu, Dec 14, 2023 at 04:44:47PM -0500, Ben Kallus wrote: > memcpy to or from NULL is undefined behavior, even for copies of > length 0. See this godbolt link for an example of how this can cause > problems: https://gcc.godbolt.org/z/zfvnMMsds > > This patch avoids calling memcpy for 0-length