[PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-10-08 Thread Martin Minarik
If the malloc in wl_array_add() fails, we are memcpy-ing to bad memory. This can happen only when copying array to smaller array. --- src/wayland-util.c | 11 --- src/wayland-util.h |2 +- tests/array-test.c |8 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --g

Re: [PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-23 Thread Daniel Stone
Hi, On 23 July 2012 21:48, Dima Ryazanov wrote: > But dlsym(RTLD_NEXT, "calloc") works, though - no need for dlopen. That's > how test-runner looks up "malloc" and "free". I meant dlsym uses calloc (through _dlerror_run) rather than dlopen, sorry. Cheers, Daniel

Re: [PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-23 Thread Dima Ryazanov
But dlsym(RTLD_NEXT, "calloc") works, though - no need for dlopen. That's how test-runner looks up "malloc" and "free". On Mon, Jul 23, 2012 at 1:02 PM, Daniel Stone wrote: > Hi, > > On 23 July 2012 16:11, Kristian Høgsberg wrote: > > On Mon, Jul 23, 2012 at 11:40:52AM +0300, Pekka Paalanen wro

Re: [PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-23 Thread Daniel Stone
Hi, On 23 July 2012 16:11, Kristian Høgsberg wrote: > On Mon, Jul 23, 2012 at 11:40:52AM +0300, Pekka Paalanen wrote: >> We don't have a realloc() wrapper yet, do we? >> Array uses realloc. We're missing calloc(), too, no? > > Yea, we don't have those. I came up against this a couple of weeks ag

Re: [PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-23 Thread Kristian Høgsberg
On Mon, Jul 23, 2012 at 11:40:52AM +0300, Pekka Paalanen wrote: > On Sun, 22 Jul 2012 14:24:15 -0400 > Kristian Høgsberg wrote: > > > > diff --git a/tests/array-test.c b/tests/array-test.c > > > index 7639878..ff5bb8c 100644 > > > --- a/tests/array-test.c > > > +++ b/tests/array-test.c > > > @@ -

Re: [PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-23 Thread Pekka Paalanen
On Sun, 22 Jul 2012 14:24:15 -0400 Kristian Høgsberg wrote: > > diff --git a/tests/array-test.c b/tests/array-test.c > > index 7639878..ff5bb8c 100644 > > --- a/tests/array-test.c > > +++ b/tests/array-test.c > > @@ -60,7 +60,9 @@ TEST(array_add) > > > > /* add some data */ > > for (i =

Re: [PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-22 Thread Kristian Høgsberg
On Thu, Jul 19, 2012 at 03:45:57AM +0200, Martin Minarik wrote: > If the malloc in wl_array_add() fails, we are memcpy-ing to bad memory. > This can happen only when copying array to smaller array. > --- > src/wayland-util.c | 11 --- > src/wayland-util.h |2 +- > tests/array-test.c

[PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-07-19 Thread Martin Minarik
If the malloc in wl_array_add() fails, we are memcpy-ing to bad memory. This can happen only when copying array to smaller array. --- src/wayland-util.c | 11 --- src/wayland-util.h |2 +- tests/array-test.c |8 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --g