mscdex / node-xxhash

An xxhash binding for node.js
Other
193 stars 28 forks source link

Segfault on zero-length Buffer #4

Closed treygriffith closed 11 years ago

treygriffith commented 11 years ago

If XXHash is passed a zero-length Buffer it segfaults. (I'm in Node v0.10.3)

For example:

var XXHash = require('xxhash');

console.log(XXHash.hash(new Buffer(""), 0xCAFEBABE));
// terminated by signal SIGSEGV (Address boundary error)

I'm currently working around this by testing the length of the Buffer before hashing, but segfaulting, instead of throwing an exception, is less than ideal behavior.

mscdex commented 11 years ago

Fixed in 357ce0c. Thanks for the heads up!