wl_array: Set data to invalid address after free
authorYong Bakos <ybakos@humanoriented.com>
Tue, 27 Sep 2016 18:03:48 +0000 (13:03 -0500)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 18 Oct 2016 09:24:53 +0000 (12:24 +0300)
commite8ad23266f36521215dcd7cfcc524e0ef67d66dd
tree00d35f79dceb980454e09b7a7235e26115de1174
parentdb61796026e0b1a2a649ad1369521ebfe2adc074
wl_array: Set data to invalid address after free

Explicitly set the data member to an invalid memory address during
wl_array_release, such that re-using a freed wl_array without re-initializing
causes a crash. In addition, this pointer assignment makes wl_array_release
testable.

Define a constant for the invalid memory address, and add documentation about
this behavior, starting at libwayland version 1.13.

See https://lists.freedesktop.org/archives/wayland-devel/2016-September/031116.html

Signed-off-by: Yong Bakos <ybakos@humanoriented.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
[Pekka: remove the doc about crashing]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
src/wayland-private.h
src/wayland-util.c