GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Decoder accepts non-minimal integer encodings · Issue #296 · msgpack/msgpack-javascript Open DescriptionSummaryThe MessagePack specification directs an encoder to use the shortest representation that holds the value, so a decoder that accepts a wider encoding admits a second encoding of a value its own encoder would never emit. Specification: https://github.com/msgpack/msgpack/blob/master/spec.md Problem
Version tested: Reproductionimport { decode, encode } from '@msgpack/msgpack'; const buf = Buffer.from('cc6c', 'hex'); const v = decode(buf); const re = Buffer.from(encode(v)); console.log('input :', buf.toString('hex')); console.log('decoded :', JSON.stringify(v, (_k, x) => typeof x === 'bigint' ? x.toString() : x)); console.log('re-encode:', re.toString('hex')); console.log(re.equals(buf) ? 'ROUNDTRIP-STABLE' : 'REENCODE-DIFFERS'); Observed output: The re-encoding differs from the input, which is the defect. Expected behaviorThe decoder should reject this input rather than accept it, because the Suggested fixWhile decoding an integer argument, check that the value could not have been Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |