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
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. #60
Comments
Can you post some test code that reproduces the problem? Feel free to start with the sample code. |
this code will generate the error
const { encode, decode } = require('dns-packet');
console.log(decode(Buffer.from('000e0100000100000000000106676f6f676c6503636f6d0000010001010029100000000000000c000a0008121badeb9ce77e55','hex')));
|
I don't know if you realize it or not but you're making this extra difficult to help you. To make it easier to help you, you could:
|
This code will generate the error.
I am not sure this code will help you more than what I provided you before. I tried to log the received message which lead to the issue The difference is not so big. In another approch, Offset which is defined and used in the index.js:1353:31 should be checked according the length of the buffer to avoid such error. |
yes, this code doesn't help at all because it isn't generating a request. You're still providing a precomputed response to decode. But your follow-on information does describe the problem more which is helpful. But I don't understand why you can't modify udp.js in the examples to exhibit the problem and post that? All I have been asking for is a request to make it easy to troubleshoot. |
I can certainly guess at this based on decoding the response by hand but I am busy and if you already know this, why can't you just make it easy for us? |
I decoded the second one by hand and it looks fine: Then I decode the first one and it's not a valid DNS packet: 000e0100000100000000000106676f6f676c6503636f6d0000010001010029100000000000000c000a0008121badeb9ce77e55 |
It seems like this is a reasonable error for a malformed packet. |
I have seen specific DNS request for google is failing with this error
RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 49. Received 73
at Object.answer.decode (/home/pi/bin/nodejs/dns/node_modules/dns-packet/index.js:1353:31)
DNS request was : 000e0100000100000000000106676f6f676c6503636f6d0000010001010029100000000000000c000a0008121badeb9ce77e55
The text was updated successfully, but these errors were encountered: