From 9ad1c19f69646138888054237e61c8934dd7d4dd Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 15 Dec 2016 09:27:02 +0000 Subject: [PATCH] Validate user text object desc more thorougly Fixes #992 Fixes #993 Fixes #994 --- src/normal.cc | 2 +- test/regression/993-user-text-object/cmd | 1 + test/regression/993-user-text-object/in | 1 + test/regression/993-user-text-object/out | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 test/regression/993-user-text-object/cmd create mode 100644 test/regression/993-user-text-object/in create mode 100644 test/regression/993-user-text-object/out diff --git a/src/normal.cc b/src/normal.cc index c0dabd44..282d18e6 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1011,7 +1011,7 @@ void select_object(Context& context, NormalParams params) return; Vector params = split(cmdline, ',', '\\'); - if (params.size() != 2) + if (params.size() != 2 or params[0].empty() or params[1].empty()) throw runtime_error{"desc parsing failed, expected ,"}; select_and_set_last( diff --git a/test/regression/993-user-text-object/cmd b/test/regression/993-user-text-object/cmd new file mode 100644 index 00000000..55e4fb6d --- /dev/null +++ b/test/regression/993-user-text-object/cmd @@ -0,0 +1 @@ +:,, diff --git a/test/regression/993-user-text-object/in b/test/regression/993-user-text-object/in new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/993-user-text-object/in @@ -0,0 +1 @@ + diff --git a/test/regression/993-user-text-object/out b/test/regression/993-user-text-object/out new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/regression/993-user-text-object/out @@ -0,0 +1 @@ +