util: abort if we try to allocate more than a MB
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 19 Jun 2018 23:34:30 +0000 (09:34 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 20 Jun 2018 01:41:48 +0000 (11:41 +1000)
commit793c8d51e871252e03fd6aac79d1bf6fd4f717d3
tree14655f38d1d7a9a9ef479860565aef493bb5e974
parent4203ab52bfd249a50bbfa305bb48f4b42e73a714
util: abort if we try to allocate more than a MB

The ssize_t cast upsets coverity for some reason but we can be a lot more
restrictive here anyway. Quick analysis of the zalloc calls in the test suite
show the largest allocation is 9204 bytes.

Let's put a cap on for one MB, anything above that is likely some memory
corruption and should be caught early.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Matheus Santana <embs@cin.ufpe.br>
src/libinput-util.h
test/litest-selftest.c