Socket
Socket
Sign inDemoInstall

@webassemblyjs/wasm-parser

Package Overview
Dependencies
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webassemblyjs/wasm-parser - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0-0

esm/decoder.js

68

lib/decoder.js

@@ -237,2 +237,16 @@ "use strict";

}
function readVaruint32() {
// where 32 bits = max 4 bytes
var bytes = readBytes(4);
var buffer = Buffer.from(bytes);
return (0, _leb.decodeUInt32)(buffer);
}
function readVaruint7() {
// where 7 bits = max 1 bytes
var bytes = readBytes(1);
var buffer = Buffer.from(bytes);
return (0, _leb.decodeUInt32)(buffer);
}
/**

@@ -950,4 +964,2 @@ * Decode a signed 32bits interger

var functionNames = [];
var subSectionSizeInBytesu32 = readU32();
eatBytes(subSectionSizeInBytesu32.nextIndex);
var numberOfFunctionsu32 = readU32();

@@ -970,8 +982,6 @@ var numbeOfFunctions = numberOfFunctionsu32.value;

function parseNameSectionLocals() {
var subSectionSizeInBytesu32 = readU32();
eatBytes(subSectionSizeInBytesu32.nextIndex);
var localNames = [];
var numbeOfFunctionsu32 = readU32();
var numbeOfFunctions = numbeOfFunctionsu32.value;
eatBytes(numbeOfFunctionsu32.nextIndex);
var localNames = [];

@@ -1006,11 +1016,33 @@ for (var i = 0; i < numbeOfFunctions; i++) {

while (offset - initialOffset < remainingBytes) {
var sectionTypeByte = readByte();
eatBytes(1);
// name_type
var sectionTypeByte = readVaruint7();
eatBytes(sectionTypeByte.nextIndex); // name_payload_len
if (sectionTypeByte === 0) {
nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameModule()));
} else if (sectionTypeByte === 1) {
nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions()));
} else if (sectionTypeByte === 2) {
nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals()));
var subSectionSizeInBytesu32 = readVaruint32();
eatBytes(subSectionSizeInBytesu32.nextIndex);
switch (sectionTypeByte.value) {
case 0:
{
nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameModule()));
break;
}
case 1:
{
nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionFunctions()));
break;
}
case 2:
{
nameMetadata.push.apply(nameMetadata, _toConsumableArray(parseNameSectionLocals()));
break;
}
default:
{
// skip unknown subsection
eatBytes(subSectionSizeInBytesu32.value);
}
}

@@ -1454,4 +1486,3 @@ }

if (opts.ignoreDataSection === true) {
var _remainingBytes = // $FlowIgnore
sectionSizeInBytes - _numberOfElements2.nextIndex;
var _remainingBytes = sectionSizeInBytes - _numberOfElementsu2.nextIndex;

@@ -1490,3 +1521,8 @@ eatBytes(_remainingBytes); // eat the entire section

if (sectionName.value === "name") {
_metadata12.push.apply(_metadata12, _toConsumableArray(parseNameSection(_remainingBytes2)));
try {
_metadata12.push.apply(_metadata12, _toConsumableArray(parseNameSection(_remainingBytes2)));
} catch (e) {
console.warn("Failed to decode custom \"name\" section @".concat(offset, "; ignoring (").concat(e.message, ")."));
eatBytes(_remainingBytes2);
}
} else {

@@ -1493,0 +1529,0 @@ // We don't parse the custom section

@@ -225,3 +225,9 @@ "use strict";

var node = _ref7.node;
node.id = moduleNameMetadataPath.node.value;
var name = moduleNameMetadataPath.node.value; // compatiblity with wast-parser
if (name === "") {
name = null;
}
node.id = name;
})

@@ -228,0 +234,0 @@ });

{
"name": "@webassemblyjs/wasm-parser",
"version": "1.6.0",
"version": "1.7.0-0",
"keywords": [

@@ -13,2 +13,3 @@ "webassembly",

"main": "lib/index.js",
"module": "esm/index.js",
"scripts": {

@@ -20,8 +21,8 @@ "test": "mocha"

"dependencies": {
"@webassemblyjs/ast": "1.6.0",
"@webassemblyjs/helper-api-error": "1.6.0",
"@webassemblyjs/helper-wasm-bytecode": "1.6.0",
"@webassemblyjs/ieee754": "1.6.0",
"@webassemblyjs/leb128": "1.6.0",
"@webassemblyjs/utf8": "1.6.0"
"@webassemblyjs/ast": "1.7.0-0",
"@webassemblyjs/helper-api-error": "1.7.0-0",
"@webassemblyjs/helper-wasm-bytecode": "1.7.0-0",
"@webassemblyjs/ieee754": "1.7.0-0",
"@webassemblyjs/leb128": "1.7.0-0",
"@webassemblyjs/utf8": "1.7.0-0"
},

@@ -36,9 +37,9 @@ "repository": {

"devDependencies": {
"@webassemblyjs/helper-buffer": "1.6.0",
"@webassemblyjs/helper-test-framework": "1.6.0",
"@webassemblyjs/helper-wasm-bytecode": "1.6.0",
"@webassemblyjs/wasm-gen": "1.6.0",
"@webassemblyjs/wast-parser": "1.6.0",
"@webassemblyjs/helper-buffer": "1.7.0-0",
"@webassemblyjs/helper-test-framework": "1.7.0-0",
"@webassemblyjs/helper-wasm-bytecode": "1.7.0-0",
"@webassemblyjs/wasm-gen": "1.7.0-0",
"@webassemblyjs/wast-parser": "1.7.0-0",
"wabt": "^1.0.0"
}
}
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