mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
Add error handling to parser.
This commit is contained in:
@@ -122,6 +122,8 @@ Guacamole.Parser = function() {
|
|||||||
element_buffer.length = 0;
|
element_buffer.length = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if (terminator != ',')
|
||||||
|
throw new Error("Illegal terminator.");
|
||||||
|
|
||||||
// Start searching for length at character after
|
// Start searching for length at character after
|
||||||
// element terminator
|
// element terminator
|
||||||
@@ -135,6 +137,8 @@ Guacamole.Parser = function() {
|
|||||||
|
|
||||||
// Parse length
|
// Parse length
|
||||||
var length = parseInt(buffer.substring(element_end+1, length_end));
|
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
|
// Calculate start of element
|
||||||
start_index = length_end + 1;
|
start_index = length_end + 1;
|
||||||
|
Reference in New Issue
Block a user