Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ByteBuffer.fromHex returns an empty buffer for non-hex characters #56

Open
recursify opened this issue Aug 4, 2015 · 1 comment
Open

Comments

@recursify
Copy link

Using version 3.5.5 with nodejs v0.12.4

var ByteBuffer = require('bytebuffer')
var a = ByteBuffer.fromHex('vvzzkk', true, false)
console.log(a);
var b = ByteBuffer.fromHex('vvzzkk', true, true)
console.log(b);

prints

{ buffer: <Buffer >,
  offset: 0,
  markedOffset: -1,
  limit: 0,
  littleEndian: true,
  noAssert: true }
{ buffer: <Buffer >,
  offset: 0,
  markedOffset: -1,
  limit: 0,
  littleEndian: true,
  noAssert: true }

I would expect it to throw an error for non-hex characters, given https://github.com/dcodeIO/ByteBuffer.js/blob/master/src/encodings/hex.js#L65

@recursify
Copy link
Author

Hmm, in the node case, it's hardcoding noAssert to true... is that intentional?

https://github.com/dcodeIO/ByteBuffer.js/blob/master/src/encodings/hex.js#L53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant