+7
-0
@@ -0,1 +1,8 @@ | ||
| ## [4.5.8](https://github.com/rvagg/cborg/compare/v4.5.7...v4.5.8) (2026-01-21) | ||
| ### Bug Fixes | ||
| * **cli:** don't omit array length bytes in diagnostic output ([b8dacb6](https://github.com/rvagg/cborg/commit/b8dacb652c02566c7b64c2638b7bcb36bb519b6b)) | ||
| * **test:** add CLI tests to `npm test` ([b19bc87](https://github.com/rvagg/cborg/commit/b19bc87ea04691f9173a5b13284e21192e0f1e3c)) | ||
| ## [4.5.7](https://github.com/rvagg/cborg/compare/v4.5.6...v4.5.7) (2026-01-21) | ||
@@ -2,0 +9,0 @@ |
+10
-3
@@ -50,5 +50,12 @@ import { Tokeniser } from './decode.js' | ||
| case 'array': | ||
| // for bytes and string, we want to print out the length part of the value prefix if it | ||
| // exists - it exists for short lengths (<24) but does for longer lengths | ||
| multilen = token.type.name === 'string' ? utf8Encoder.encode(token.value).length : token.value.length | ||
| // print the length bytes if they exist (length >= 24) | ||
| // for string/bytes, token.value is the content; for array/map, token.value IS the count | ||
| if (token.type.name === 'string') { | ||
| multilen = utf8Encoder.encode(token.value).length | ||
| } else if (token.type.name === 'bytes') { | ||
| multilen = token.value.length | ||
| } else { | ||
| // array or map - value is the count directly | ||
| multilen = token.value | ||
| } | ||
| if (multilen >= uintBoundaries[0]) { | ||
@@ -55,0 +62,0 @@ if (multilen < uintBoundaries[1]) { |
+3
-2
| { | ||
| "name": "cborg", | ||
| "version": "4.5.7", | ||
| "version": "4.5.8", | ||
| "description": "Fast CBOR with a focus on strictness", | ||
@@ -16,4 +16,5 @@ "main": "cborg.js", | ||
| "test:node": "c8 --check-coverage --exclude=test/** mocha test/test-*.js", | ||
| "test:node-bin": "mocha test/node-test-bin.js", | ||
| "test:browser": "polendina --cleanup test/test-*.js", | ||
| "test": "npm run lint && npm run build && npm run test:node && npm run test:browser", | ||
| "test": "npm run lint && npm run build && npm run test:node && npm run test:node-bin && npm run test:browser", | ||
| "test:ci": "npm run test", | ||
@@ -20,0 +21,0 @@ "coverage": "c8 --reporter=html --reporter=text mocha test/test-*.js && npx st -d coverage -p 8888" |
@@ -100,3 +100,3 @@ /* eslint-env mocha */ | ||
| Valid commands: | ||
| \tbin2diag [binary input] | ||
| \tbin2diag [--width <width>] [binary input] | ||
| \tbin2hex [binary input] | ||
@@ -108,6 +108,6 @@ \tbin2json [--pretty] [binary input] | ||
| \thex2bin [hex input] | ||
| \thex2diag [hex input] | ||
| \thex2diag [--width <width>] [hex input] | ||
| \thex2json [--pretty] [hex input] | ||
| \tjson2bin '[json input]' | ||
| \tjson2diag '[json input]' | ||
| \tjson2diag [--width <width>] '[json input]' | ||
| \tjson2hex '[json input]' | ||
@@ -129,3 +129,3 @@ Input may either be supplied as an argument or piped via stdin | ||
| Valid commands: | ||
| \tbin2diag [binary input] | ||
| \tbin2diag [--width <width>] [binary input] | ||
| \tbin2hex [binary input] | ||
@@ -137,6 +137,6 @@ \tbin2json [--pretty] [binary input] | ||
| \thex2bin [hex input] | ||
| \thex2diag [hex input] | ||
| \thex2diag [--width <width>] [hex input] | ||
| \thex2json [--pretty] [hex input] | ||
| \tjson2bin '[json input]' | ||
| \tjson2diag '[json input]' | ||
| \tjson2diag [--width <width>] '[json input]' | ||
| \tjson2hex '[json input]' | ||
@@ -154,3 +154,3 @@ Input may either be supplied as an argument or piped via stdin | ||
| Valid commands: | ||
| \tbin2diag [binary input] | ||
| \tbin2diag [--width <width>] [binary input] | ||
| \tbin2hex [binary input] | ||
@@ -162,6 +162,6 @@ \tbin2json [--pretty] [binary input] | ||
| \thex2bin [hex input] | ||
| \thex2diag [hex input] | ||
| \thex2diag [--width <width>] [hex input] | ||
| \thex2json [--pretty] [hex input] | ||
| \tjson2bin '[json input]' | ||
| \tjson2diag '[json input]' | ||
| \tjson2diag [--width <width>] '[json input]' | ||
| \tjson2hex '[json input]' | ||
@@ -350,2 +350,19 @@ Input may either be supplied as an argument or piped via stdin | ||
| describe('diag length bytes', () => { | ||
| // issue #137 - array and map length bytes were missing for lengths >= 24 | ||
| it('array with 24 elements', async () => { | ||
| // 98 18 = array(24), then 24 uint(1) values | ||
| const hex = '9818' + '01'.repeat(24) | ||
| const { stdout, stderr } = await execBin(`hex2diag ${hex}`) | ||
| assert.strictEqual(stderr, '') | ||
| assert.ok(stdout.startsWith('98 18 # array(24)\n')) | ||
| }) | ||
| it('map with 24 entries', async () => { | ||
| // b8 18 = map(24), then 24 pairs of string('a')=uint(1) | ||
| const hex = 'b818' + '616101'.repeat(24) | ||
| const { stdout, stderr } = await execBin(`hex2diag ${hex}`) | ||
| assert.strictEqual(stderr, '') | ||
| assert.ok(stdout.startsWith('b8 18 # map(24)\n')) | ||
| }) | ||
| it('compact', async () => { | ||
@@ -352,0 +369,0 @@ const { stdout, stderr } = await execBin('json2diag', '"aaaaaaaaaaaaaaaaaaaaaaa"') |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
434123
0.37%9594
0.23%