From d89f9845ab4a567cf12fd1c1f3fbf1958d35b9ed Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 24 Feb 2013 18:43:04 -0600 Subject: [PATCH] fix finding end of string table. --- lib/tput.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/tput.js b/lib/tput.js index 339336f..c116127 100644 --- a/lib/tput.js +++ b/lib/tput.js @@ -295,6 +295,7 @@ Tput.prototype.parseExtended = function(data, _data, _h, _i) { i = data.length - h.lastStrTableOffset; // String Table + var high = 0; _strings.forEach(function(offset, k) { if (offset === -1) { _strings[k] = ''; @@ -311,13 +312,24 @@ Tput.prototype.parseExtended = function(data, _data, _h, _i) { return; } + // Find out where the string table ends by + // getting the highest string length. + if (high < j - i) { + high = j - i; + } + _strings[k] = data.toString('ascii', s, j); }); // Symbol Table - i = h.lastStrTableOffset - 68; + // Add one to the highest string length because we didn't count \0. + i += high + 1; l = data.length; + console.log(data.slice(i - 1 - 10, i - 1 + 10)); + console.log(i); + process.exit(0); + var sym = [] , j = 0;