From 7817ba2340e11894c91f74d97114175ae705e28a Mon Sep 17 00:00:00 2001 From: Alcaro Date: Fri, 24 Nov 2017 22:14:03 +0100 Subject: [PATCH] Add ugly check --- libretro-common/file/nbio/nbio_unixmmap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libretro-common/file/nbio/nbio_unixmmap.c b/libretro-common/file/nbio/nbio_unixmmap.c index 0decab5aac..8e1f5af5b3 100644 --- a/libretro-common/file/nbio/nbio_unixmmap.c +++ b/libretro-common/file/nbio/nbio_unixmmap.c @@ -68,6 +68,13 @@ bool nbio_iterate(struct nbio_t* handle) void nbio_resize(struct nbio_t* handle, size_t len) { + if (len < handle->len) + { + /* this works perfectly fine if this check is removed, but it won't work on other nbio implementations */ + /* therefore, it's blocked so nobody accidentally relies on it */ + puts("ERROR - attempted file shrink operation, not implemented"); + abort(); + } if (ftruncate(handle->fd, len) != 0) { puts("ERROR - couldn't resize file (ftruncate)");