From: Gerhard Sittig Date: Tue, 2 Jan 2018 21:13:06 +0000 (+0100) Subject: main.cpp: check log level range before using its value X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=ed6f8680ba30649409b35ffccb7f815cb7b1a23a;p=pulseview.git main.cpp: check log level range before using its value (Silently) ignore invalid -l loglevel specs. This avoids a crash reported in bug #1071. --- diff --git a/main.cpp b/main.cpp index 8f495419..0f9aec2f 100644 --- a/main.cpp +++ b/main.cpp @@ -121,6 +121,10 @@ int main(int argc, char *argv[]) case 'l': { const int loglevel = atoi(optarg); + if (loglevel < 0 || loglevel > 5) { + qDebug() << "ERROR: invalid log level spec."; + break; + } context->set_log_level(sigrok::LogLevel::get(loglevel)); #ifdef ENABLE_DECODE