0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test
Ben Noordhuis f101f7c9ba buffers: honor length argument in base64 decoder
Honor the length argument in `buf.write(s, 0, buf.length, 'base64')`. Before
this commit, the length argument was ignored. The decoder would keep writing
until it hit the end of the buffer. Since most buffers in Node are slices of
a parent buffer (the slab), this bug would overwrite the content of adjacent
buffers.

The bug is trivially demonstrated with the following test case:

    var assert = require('assert');
    var a = Buffer(3);
    var b = Buffer('xxx');
    a.write('aaaaaaaa', 'base64');
    assert.equal(b.toString(), 'xxx');

This commit coincidentally also fixes a bug where Buffer._charsWritten was not
updated for zero length buffers.
2012-02-02 19:13:56 +01:00
..
disabled test: add missing copyright headers 2011-12-06 22:02:26 +01:00
fixtures Fix #2507 Raise errors less agressively when destroying stdio streams 2012-01-26 17:55:44 -08:00
internet Tests: fix jslint issues 2012-01-17 19:45:09 +01:00
message Tests: fix jslint issues 2012-01-17 19:45:09 +01:00
pummel Tests: fix jslint issues 2012-01-17 19:45:09 +01:00
simple buffers: honor length argument in base64 decoder 2012-02-02 19:13:56 +01:00
CMakeLists.txt cmake cleanup 2010-11-23 23:33:19 -06:00
common.js tests: fix more lint issues 2012-01-17 20:16:49 +01:00