BewareMyPower opened a new pull request, #219:
URL: https://github.com/apache/pulsar-client-node/pull/219
There is a segmentation fault reported by the user.
> So, I recompiled the extension with `node-gyp rebuild --debug` then
attached a debugger and it crashed because of this
>
> ```
> (gdb) l
> 60 void MessageListenerProxy(Napi::Env env, Napi::Function
jsCallback, MessageListenerProxyData *data) {
> 61 Napi::Object msg = Message::NewInstance({}, data->cMessage);
> 62 Consumer *consumer = data->consumer;
> 63 delete data;
> 64
> 65 jsCallback.Call({msg, consumer->Value()});
> 66 }
> 67
> 68 void MessageListener(pulsar_consumer_t *cConsumer,
pulsar_message_t *cMessage, void *ctx) {
> 69 ListenerCallback *listenerCallback = (ListenerCallback *)ctx;
> (gdb)
> ```
The `consumer` field is assigned from `MessageListenerCallback` and the
initial value is `nullptr`. This field could only be modified in
`Consumer::SetListenerCallback`. I didn't look deeper into where it's invoked,
but I think it's better to add the null check here for safety.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]