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

js-binary-schema-parser

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-binary-schema-parser - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

10

lib/index.js

@@ -47,6 +47,14 @@ "use strict";

var arr = [];
var lastStreamPos = stream.pos;
while (continueFunc(stream, result, parent)) {
var newParent = {};
parse(stream, schema, result, newParent);
parse(stream, schema, result, newParent); // cases when whole file is parsed but no termination is there and stream position is not getting updated as well
// it falls into infinite recursion, null check to avoid the same
if (stream.pos === lastStreamPos) {
break;
}
lastStreamPos = stream.pos;
arr.push(newParent);

@@ -53,0 +61,0 @@ }

5

lib/schemas/gif.js

@@ -21,3 +21,6 @@ "use strict";

for (var size = (0, _uint.readByte)()(stream); size !== terminator; size = (0, _uint.readByte)()(stream)) {
// catch corrupted files with no terminator
// size becomes undefined for some case when file is corrupted and terminator is not proper
// null check to avoid recursion
if (!size) break; // catch corrupted files with no terminator
if (stream.pos + size >= streamSize) {

@@ -24,0 +27,0 @@ var availableSize = streamSize - stream.pos;

{
"name": "js-binary-schema-parser",
"version": "2.0.2",
"version": "2.0.3",
"description": "Parse binary files with a schema into nicely readable objects",

@@ -5,0 +5,0 @@ "dependencies": {},

@@ -76,2 +76,4 @@ # js Binary Schema Parser

[Wethrift.com][6]
[1]: https://www.producthunt.com/posts/ruffle

@@ -82,1 +84,2 @@ [2]: https://github.com/matt-way/gifuct-js

[5]: https://twitter.com/nickdrewe
[6]: https://wethrift.com

@@ -36,5 +36,12 @@ export const parse = (stream, schema, result = {}, parent = result) => {

const arr = []
let lastStreamPos = stream.pos;
while (continueFunc(stream, result, parent)) {
const newParent = {}
parse(stream, schema, result, newParent)
// cases when whole file is parsed but no termination is there and stream position is not getting updated as well
// it falls into infinite recursion, null check to avoid the same
if(stream.pos === lastStreamPos) {
break
}
lastStreamPos = stream.pos
arr.push(newParent)

@@ -41,0 +48,0 @@ }

@@ -25,2 +25,5 @@ import { conditional, loop } from '../'

) {
// size becomes undefined for some case when file is corrupted and terminator is not proper
// null check to avoid recursion
if(!size) break;
// catch corrupted files with no terminator

@@ -27,0 +30,0 @@ if (stream.pos + size >= streamSize) {

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