fix finding end of string table.
This commit is contained in:
parent
1bd2a71946
commit
d89f9845ab
14
lib/tput.js
14
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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue