From b115a946684a0781652e128ab36fd65896963a20 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 12 Mar 2021 21:12:54 +0100 Subject: [PATCH] Added a sanity check to the --resolution flag to keep the values within reason. --- es-app/src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 2f25b1c20..cae13a622 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -183,6 +183,12 @@ bool parseArgs(int argc, char* argv[]) } int width = atoi(argv[i + 1]); int height = atoi(argv[i + 2]); + if (width < 640 || height < 480 || width > 7680 || height > 4320 || + height < width / 4 || width < height / 2) { + std::cerr << "Error: Unsupported resolution " + << width << "x" << height << " supplied.\n"; + return false; + } Settings::getInstance()->setInt("WindowWidth", width); Settings::getInstance()->setInt("WindowHeight", height); i += 2;