From 199668e936ba87e2f9d88562d83b89dc3cc40a5a Mon Sep 17 00:00:00 2001 From: Fred Ross-Perry Date: Mon, 6 Aug 2018 14:20:43 -0700 Subject: Check that characters aren't left over in AFSpecial_KeystrokeEx. In the Javascript function AFSpecial_KeystrokeEx, if there are characters left over after exhausting the format string, it's not a match. --- source/pdf/js/util.js | 4 ++++ source/pdf/js/util.js.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/pdf/js/util.js b/source/pdf/js/util.js index 03e4a61b..dd58dff7 100644 --- a/source/pdf/js/util.js +++ b/source/pdf/js/util.js @@ -717,6 +717,10 @@ function AFSpecial_KeystrokeEx(fmt) { i++; } + // If there are characters left over in the value, it's not a match. + if (val.length > 0) + event.rc = false; + if (event.rc) event.value = res; else if (event.willCommit) diff --git a/source/pdf/js/util.js.h b/source/pdf/js/util.js.h index de27f97d..a8bf9619 100644 --- a/source/pdf/js/util.js.h +++ b/source/pdf/js/util.js.h @@ -717,6 +717,10 @@ "i++;\n" "}\n" "\n" +"\n" +"if (val.length > 0)\n" +"event.rc = false;\n" +"\n" "if (event.rc)\n" "event.value = res;\n" "else if (event.willCommit)\n" -- cgit v1.2.3