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

@socketsupply/ltp

Package Overview
Dependencies
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socketsupply/ltp - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

10

generate.js

@@ -29,2 +29,7 @@ var path = require('path')

if(pointed)
if(!pointed.type) throw new Error('pointed codec must have type, was:'+JSON.stringify(field))
if(direct)
if(!direct.type) throw new Error('direct codec must have type, was:'+JSON.stringify(field))
//Direct to Pointed - (variable size value)

@@ -82,6 +87,5 @@ if(direct && pointed) {

if(field.isLength) {
s += (`
void ${encode(field)} (byte* buf, byte* free) {
ltp_encode__${direct.type}((byte*)(buf+${position}), (${direct.type})(free-buf));
ltp_encode__${direct.type}((byte*)(buf+${position}), (${direct.type})(free-buf-${field.offset|0}));
}

@@ -91,3 +95,3 @@ `)

${direct.type}* ${decode(field)} (byte* buf) {
return ltp_decode__${direct.type}((byte*)(buf+${position}));
return ltp_decode__${direct.type}((byte*)(buf+${position}+${field.offset|0}));
}

@@ -94,0 +98,0 @@ `)

@@ -66,3 +66,3 @@ 'use strict'

var _end = start + decode.bytes
if(_end > end) throw new Error('length field out of bounds')
if(_end > end) throw new Error('length field out of bounds, expected:'+end+', got:'+_end)
//but a smaller value for end is acceptable.

@@ -69,0 +69,0 @@ end = _end

{
"name": "@socketsupply/ltp",
"version": "2.1.0",
"version": "2.1.1",
"description": "A schemaful parseless binary format, like a simpler version of captnproto. fast access to fields without allocating memory",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -71,4 +71,2 @@ var codex = require('./codex')

assertFixedSize(direct)
// console.log("LengthField", {name, position, direct, isLength: true})
// if(position !== 0) throw new Error('length position must be zero')
return {

@@ -171,8 +169,4 @@ name, position, direct, isLength: true, offset

function decodeField (position, direct, pointed, buffer, start, end=buffer.length, allow_zero=false) {
// if(!direct)
// throw new Error('field must have direct codec')
var test = direct && start + position + direct.bytes > end
if(test) {
// console.log('lo???g', {direct, start, position, end});
// console.log()
//TODO XXX end is not big enough to contain: start + position + direct.bytes

@@ -179,0 +173,0 @@ throw new Error('direct value out of bounds? attempted to read '+direct.type+' at:'+ (start+position) + '(position:'+position+') end was:'+ end)

Sorry, the diff of this file is not supported yet

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