Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


quick fix for issue #65 #92

merged 1 commit into from

4 participants

Tobias Matt Bornski Vincent Voyer Theo Schlossnagle

At data.copy(), sourceEnd was sometimes bigger than data.length which caused the error. This makes sure sourceEnd does not exceed data.length. Fixed the problem for me.

Matt Bornski

bump. I run into this issue fairly often.

Matt Bornski

Hey, after closer investigation, my issue was actually regarding targetStart, not sourceEnd.

Furthermore, I've been able to identify the root cause:

exchange.publish('', JSON.stringify({'foo':'foo', 'bar': <some buffer>}));

I was able to publish buffers to the exchange; this is developer error, but when the consumer receives the buffer representation, all hell breaks loose in the parser.

Vincent Voyer
vvo commented

I too had the problem and it can be easily reproduced : send big data buffers into amqp without stringifying them.

exchange.publish('', new Buffer(0.5*1024*1024));

This will cause a copy error meaning something is wrong with the data event on the msg object.

Does that means we should not send new Buffer('helllo');? The lib should be able to handle this right?

Vincent Voyer
vvo commented

I guess this is related to : squaremo/rabbit.js#24 so not just Buffers() but all messages > 100kb

Theo Schlossnagle postwait merged commit a36409f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 16, 2012
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +2 −1  amqp.js
3  amqp.js
@@ -166,7 +166,8 @@ function AMQPParser (version, type) {
function frame(data) {
var fb = frameBuffer;
var needed = fb.length - fb.used;
- data.copy(fb, fb.used, 0, data.length);
+ var sourceEnd = (fb.length > data.length) ? data.length : fb.length;
+ data.copy(fb, fb.used, 0, sourceEnd);
fb.used += data.length;
if (data.length > needed) {
return frameEnd(data.slice(needed));
Something went wrong with that request. Please try again.