joyent/node — Issue #1975: Buffer error message should not dump buffer's memory contents
Author: nalply
Created: 2011-10-31 14:29:15+00:00
State: open

nalp@muse:~/mtrude$ node -v; node -e '(new Buffer(10).x())'
v0.5.10

undefined:1
*
^
TypeError: Object ��R���R4 has no method 'x'
at Object. (eval at (eval:1:75))
at Object. (eval:1:63)
at Module._compile (module.js:432:26)
at startup (node.js:84:14)
at node.js:534:3

Expected behavior:

undefined:1
*
^
TypeError: Buffer has no method 'x'
at Object. (eval at (eval:1:75))
at Object. (eval:1:63)
at Module._compile (module.js:432:26)
at startup (node.js:84:14)
at node.js:534:3

**Note!** It is even worse for `new Buffer(1000)` or even `new Buffer(1024 * 1024)`... Also

node -e 'b = new Buffer(5); b[0] = 27; b[1] = 91; b[2] = 51; b[3] = 50; b[4] = 109; b.x()'

paints the rest of the stack trace green.