peterprib / node-red-contrib-kafka-manager

Implement
GNU General Public License v3.0
22 stars 12 forks source link

Integer overflow #18

Closed caeaugusto closed 4 years ago

caeaugusto commented 4 years ago

Hi, first of all, congrats on a nice kafka node and thank you for maintaining the only kafka one that's still alive!

I just wanted to report a possible bug... it seems that in a certain situation which I couldn't pinpoint, if you send a json string value with only a number inside, and this number is bigger than the 4-byte max value through the kafka manager nodes, it makes node-red crash in its entirety. It's not possible to catch using the catch-all node, but a log is written:

RangeError [ERR_OUT_OF_RANGE]: The value of "value" is out of range. It must be >= -128 and <= 127. Received 12345678922 at writeU_Int8 (internal/buffer.js:555:11) at Buffer.writeInt8 (internal/buffer.js:686:10) at BufferMaker.make (/data/node_modules/buffermaker/lib/BufferMaker.js:77:36) at encodeMessage (/data/node_modules/kafka-node/lib/protocol/protocol.js:894:9) at /data/node_modules/kafka-node/lib/protocol/protocol.js:871:15 at Array.forEach () at encodeMessageSet (/data/node_modules/kafka-node/lib/protocol/protocol.js:870:14) at /data/node_modules/kafka-node/lib/protocol/protocol.js:860:24 at Array.forEach () at /data/node_modules/kafka-node/lib/protocol/protocol.js:859:10

Maybe the string is being wrongly converted to a number and sent to the kafka-node lib as such? Or can it be a kafka-node bug?

node-red-contrib-kafka-manager version: 0.2.14 node-red version: 1.0.4 steps to reproduce: Unfortunately, I don't know how without sending production code. It's consistently reproductible in one of my flows, but not in others. I tried creating a smaller test but it doesn't reproduce. If I send some characters in the string along with the number, the error goes away.

Could you please take a look into it? Thanks!

peterprib commented 4 years ago

looking at stack trace implies bug in kafka-node. If you post how to reproduce will see if I can reproduced and catch issue rather than crash.