[PATCH wayland v2 0/4] wl_array: documentation and test

Pekka Paalanen ppaalanen at gmail.com
Tue Oct 18 09:41:36 UTC 2016


On Tue, 27 Sep 2016 13:03:46 -0500
Yong Bakos <junk at humanoriented.com> wrote:

> From: Yong Bakos <ybakos at humanoriented.com>
> 
> This series adds documentation to wl_array and its methods.
> 
> There is one implementation change: defining an invalid pointer address, and
> setting the `data` pointer to the invalid pointer address after free, in
> wl_array_release. I did not set `size` and `alloc` to 0, in order to
> keep the change miniminal. (Should I?)
> 
> Regards,
> yong

Hi Yong,

all 4 patches pushed:
   f7e1dcc..a1ab2c0  master -> master

But I did some edits, please check the patches in master:

> Yong Bakos (4):
>   util: Document wl_array

This was good.

>   wl_array: Set data to invalid address after free

I removed the doc about crashing. I felf a bit weird to try to
guarantee a crash in documentation, and it's not like it was supposed
to work before. It's also not a new behaviour one would ever like to
rely on.

>   tests: Test wl_array_release

I added a new variable to assign the return value from wl_array_add()
instead of array.data. The function itself is supposed to update
array.data and we don't want to overwrite it. (It's also kind of
illegal to overwrite it.)

>   array-test: Include wayland-util.h and simplify init test

I added this hunk anyway:
+	/* fill with garbage to emulate uninitialized memory */
+	memset(&array, 0x57, sizeof array);

I hope it's all fine, but if not, let me know.


Thanks,
pq

> 
>  src/wayland-private.h |  3 +++
>  src/wayland-util.c    |  1 +
>  src/wayland-util.h    | 75 +++++++++++++++++++++++++++++++++++++++++++++++----
>  tests/array-test.c    | 27 +++++++++++--------
>  4 files changed, 90 insertions(+), 16 deletions(-)
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20161018/faad3263/attachment.sig>


More information about the wayland-devel mailing list