-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Data still available after parsing" error crashes script #85
Comments
Interesting, is it bad data that is being sent? It would be useful to have a payload to see what is is, and incorporate into tests. We may need to handle this check https://github.com/bitpay/bitcore-p2p/blob/master/lib/messages/commands/addr.js#L48 better. |
Is this accurate? > var buf = new Buffer(new Uint8Array([1,42,233,205,86,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,128,8,124,7,71,157,0,0,0,0]));
> buf.toString('hex');
'012ae9cd56010000000000000000000000000000000000ffff80087c07479d00000000' |
Yes that's correct. |
So it looks it's parsed with:
And has 4 bytes remaining (which may or may not be of concern). |
Well, it is of concern to Bitcore as it checks that the buffers has been completely read, and that causes |
Any progress on fixing this? This is a serious blocker for us. |
It doesn't look like there is an issue parsing the info, as this matches up with https://en.bitcoin.it/wiki/Protocol_documentation#addr with the exception of the last four bytes:
|
Well, I don't know whether there is an issue parsing the info, but I do know that receiving an invalid message shouldn't crash the process. That's a pretty obvious DoS vulnerability. |
There are foreseeable other parsing and transaction/block validation issues, and connecting to a trusted peer is often used: Though we could certainly improve the robustness. |
Using trusted peers defeats the purpose of Bitcoin. It shouldn't be very hard to add proper error handling so that when a parsing error occurs, the message is just ignored, instead of crashing the whole process. |
this makes my code crash also |
I have encountered a similar problem, I still don't know how to solve it.https://github.com/bitpay/bitcore/issues/2183 |
I use this simple code:
However, after a minute or two, I get the following exception and the script crashes:
How to handle the error and carry on?
The text was updated successfully, but these errors were encountered: