From 2b82e523bf1c522e5498b5abe7063299f495b334 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Thu, 7 May 2015 15:46:38 +0800 Subject: [PATCH] Fix a potential out-of-bound issue in Accelerator. --- atom/browser/ui/accelerator_util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/ui/accelerator_util.cc b/atom/browser/ui/accelerator_util.cc index d210501ad8df..87e56d063d7e 100644 --- a/atom/browser/ui/accelerator_util.cc +++ b/atom/browser/ui/accelerator_util.cc @@ -175,7 +175,7 @@ bool StringToAccelerator(const std::string& description, } else if (tokens[i].size() > 1 && tokens[i][0] == 'f') { // F1 - F24. int n; - if (base::StringToInt(tokens[i].c_str() + 1, &n)) { + if (base::StringToInt(tokens[i].c_str() + 1, &n) && n > 0 && n < 25) { key = static_cast(ui::VKEY_F1 + n - 1); } else { LOG(WARNING) << tokens[i] << "is not available on keyboard";