C++ Toolchain [e.g. Visual Studio, llvm, g++]: g++
node-rdkafka version [e.g. 2.3.3]: 2.15.0
Steps to Reproduce
Run attached test script. It will crash, trying to do a readInt32LE() operation on the Buffer due to it being previously converted to a string value.
node-rdkafka Configuration Settings
see script
Additional context
The issue is resolved when applying PR #968. Sample file to reproduce: test.js.txt
Output from 2.15.0 module
rebalance_cb called
running producer...
data.value: test-payload-value
[ { myID: <Buffer 43 02> } ]
node:internal/buffer:84
throw new ERR_BUFFER_OUT_OF_BOUNDS();
^
RangeError [ERR_BUFFER_OUT_OF_BOUNDS]: Attempt to access memory outside buffer bounds
at new NodeError (node:internal/errors:372:5)
at boundsError (node:internal/buffer:84:11)
at Uint8Array.readInt32LE (node:internal/buffer:390:5)
at KafkaConsumer.<anonymous> (test.js:38:39)
at KafkaConsumer.emit (node:events:527:28)
at readCallback (./node_modules/node-rdkafka/lib/kafka-consumer.js:448:12) {
code: 'ERR_BUFFER_OUT_OF_BOUNDS'
}
Output from patched module
rebalance_cb called
running producer...
data.value: test-payload-value
[ { myID: <Buffer 43 02 00 00> } ]
myIDVal should be 579: 579
myIDVal type should be 'number': number
Environment Information
Steps to Reproduce Run attached test script. It will crash, trying to do a
readInt32LE()
operation on the Buffer due to it being previously converted to a string value.node-rdkafka Configuration Settings see script
Additional context The issue is resolved when applying PR #968. Sample file to reproduce: test.js.txt
Output from 2.15.0 module
Output from patched module