From c33edc9b41ccdd7ec3fe711d3a96002b266106bd Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 10 Jan 2023 21:38:01 -0500 Subject: Fix checks for invalid view positions --- src/mac.m | 2 +- src/win.c | 2 +- src/x11.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mac.m b/src/mac.m index 77c825f..7b4e3a2 100644 --- a/src/mac.m +++ b/src/mac.m @@ -1718,7 +1718,7 @@ puglSetFrame(PuglView* view, const PuglRect frame) PuglStatus puglSetPosition(PuglView* const view, const int x, const int y) { - if (x > INT16_MAX || y > INT16_MAX) { + if (x < INT16_MIN || x > INT16_MAX || y < INT16_MIN || y > INT16_MAX) { return PUGL_BAD_PARAMETER; } diff --git a/src/win.c b/src/win.c index 4c4c815..d8c574b 100644 --- a/src/win.c +++ b/src/win.c @@ -1222,7 +1222,7 @@ puglSetFrame(PuglView* view, const PuglRect frame) PuglStatus puglSetPosition(PuglView* const view, const int x, const int y) { - if (x > INT16_MAX || y > INT16_MAX) { + if (x < INT16_MIN || x > INT16_MAX || y < INT16_MIN || y > INT16_MAX) { return PUGL_BAD_PARAMETER; } diff --git a/src/x11.c b/src/x11.c index ff7996a..f1a077b 100644 --- a/src/x11.c +++ b/src/x11.c @@ -1845,7 +1845,7 @@ puglSetPosition(PuglView* const view, const int x, const int y) Display* const display = view->world->impl->display; const Window win = view->impl->win; - if (x > INT16_MAX || y > INT16_MAX) { + if (x < INT16_MIN || x > INT16_MAX || y < INT16_MIN || y > INT16_MAX) { return PUGL_BAD_PARAMETER; } -- cgit v1.2.1