From 0e920a58165086e3364aa420c8aef1aa893da395 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Thu, 1 Nov 2012 11:15:26 -0700 Subject: [PATCH] Add error handling to parser. --- guacamole-common-js/src/main/resources/guacamole.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guacamole-common-js/src/main/resources/guacamole.js b/guacamole-common-js/src/main/resources/guacamole.js index c0a605cdc..46b39d98f 100644 --- a/guacamole-common-js/src/main/resources/guacamole.js +++ b/guacamole-common-js/src/main/resources/guacamole.js @@ -122,6 +122,8 @@ Guacamole.Parser = function() { element_buffer.length = 0; } + else if (terminator != ',') + throw new Error("Illegal terminator."); // Start searching for length at character after // element terminator @@ -135,6 +137,8 @@ Guacamole.Parser = function() { // Parse length var length = parseInt(buffer.substring(element_end+1, length_end)); + if (length == NaN) + throw new Error("Non-numeric character in element length."); // Calculate start of element start_index = length_end + 1;