Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bplist-parser

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bplist-parser - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/utf16.plist

49

bplistParser.js

@@ -93,6 +93,6 @@ 'use strict';

return parseData();
case 0x5:
return parseAsciiString();
case 0x6:
return parseUtf16String();
case 0x5: // ASCII
return parsePlistString();
case 0x6: // UTF-16
return parsePlistString(true);
case 0x8:

@@ -178,3 +178,3 @@ return parseUid();

function parseAsciiString() {
function parsePlistString (isUtf16) {
var length = objInfo;

@@ -186,7 +186,7 @@ var stroffset = 1;

if (intType != 0x1) {
console.error("0x5: UNEXPECTED LENGTH-INT TYPE! " + intType);
console.err("UNEXPECTED LENGTH-INT TYPE! " + intType);
}
var intInfo = int_type & 0x0F;
var intLength = Math.pow(2, intInfo);
stroffset = 2 + intLength;
var stroffset = 2 + intLength;
if (intLength < 3) {

@@ -198,37 +198,14 @@ length = readUInt(buffer.slice(offset + 2, offset + 2 + intLength));

}
//length is String length -> to get byte length multiply by 2, as 1 character takes 2 bytes in UTF-16
if (isUtf16) {
console.log('is utf 16');
length *= 2;
}
if (length < exports.maxObjectSize) {
return buffer.slice(offset + stroffset, offset + stroffset + length).toString('utf8');
} else {
throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
throw new Error("To little heap space available! Watned to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
}
}
function parseUtf16String() {
throw new Error("parseUtf16String not implemented");
// int length = objInfo;
// int stroffset = 1;
// if (objInfo == 0xF) {
// int int_type = bytes[offset + 1];
// int intType = (int_type & 0xF0) / 0x10;
// if (intType != 0x1) {
// System.err.println("UNEXPECTED LENGTH-INT TYPE! " + intType);
// }
// int intInfo = int_type & 0x0F;
// int intLength = (int) Math.pow(2, intInfo);
// stroffset = 2 + intLength;
// if (intLength < 3) {
// length = (int) parseUnsignedInt(copyOfRange(bytes, offset + 2, offset + 2 + intLength));
// } else {
// length = new BigInteger(copyOfRange(bytes, offset + 2, offset + 2 + intLength)).intValue();
// }
// }
// //length is String length -> to get byte length multiply by 2, as 1 character takes 2 bytes in UTF-16
// length *= 2;
// if (length < exports.maxObjectSize) {
// return new NSString(copyOfRange(bytes, offset + stroffset, offset + stroffset + length), "UTF-16BE");
// } else {
// throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available.");
// }
}
function parseUid() {

@@ -235,0 +212,0 @@ throw new Error("parseUid not implemented");

{
"name": "bplist-parser",
"version": "0.0.1",
"version": "0.0.2",
"description": "Binary plist parser.",

@@ -19,3 +19,6 @@ "main": "bplistParser.js",

},
"repository": { "type": "git", "url": "https://github.com/nearinfinity/node-bplist-parser.git" }
"repository": {
"type": "git",
"url": "https://github.com/nearinfinity/node-bplist-parser.git"
}
}

@@ -79,3 +79,22 @@ 'use strict';

});
},
'utf16': function (test) {
var file = path.join(__dirname, "utf16.plist");
var startTime = new Date();
bplist.parseFile(file, function (err, dicts) {
if (err) {
throw err;
}
var endTime = new Date();
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms');
var dict = dicts[0];
test.equal(dict['CFBundleName'], 'sellStuff');
test.equal(dict['CFBundleShortVersionString'], '2.6.1');
test.done();
});
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc