feross/buffer — pull request #30 by dcousens (2014-05-24 09:44:22+00:00)
Title: Fix support for arrays of signed ints

If `Buffer._useTypedArrays` is `false`, the current implementation will directly copy the contents of an `Arrayish` object into `buf` inside the `Buffer` constructor.
In most cases, this is acceptable behaviour, however this will cause disastrous results if a negative integer is passed.

For example, using `buffer.toString('hex')` will output with the `'' + -1` equivalent, not actual hex.
`new Buffer([-1, -1, -1]).toString('hex')` would become `0-10-10-1`.

This occurs in Firefox (all release versions) simple because typed array support does not exist (and therefore won't likely occur in Firefox 30).