Skip to content
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

Proposal: Decorate "overflow unpacking" errors with where in the unpacking the error occurred. #1576

Open
EricIO opened this issue Jun 16, 2024 · 9 comments

Comments

@EricIO
Copy link

EricIO commented Jun 16, 2024

I'm quite willing to do this work myself but wanted to first check if it is something that might get accepted.

We're seeing overflow unpacking uint16 errors in our system and are having trouble reproducing it locally / getting a packet capture to see what is going on. One thing that might help us pinpoint what is going on would be some better logging.

The proposal would be to decorate errors from the unpackUint* and related family of functions with where the error occurred. For example:

	hdr.Rrtype, off, err = unpackUint16(msg, off)
	if err != nil {
		return hdr, len(msg), msg, err
	}

to

	hdr.Rrtype, off, err = unpackUint16(msg, off)
	if err != nil {
		return hdr, len(msg), msg, fmt.Errorf("header.Rrtype: %w", err)
	}
@bkr-JNPR
Copy link

@EricIO , I am also seeing the same overflow issue in this package, issue happens rarely, dns packet looks fine.
not able to find out which DNS contents getting corrupted or some other reason.

please let me know if u already know more information .

@miekg
Copy link
Owner

miekg commented Jun 18, 2024 via email

@EricIO
Copy link
Author

EricIO commented Jun 20, 2024

Great. I'll try and have a draft PR up by the end of the weekend.

@bkr-JNPR
Copy link

@miekg , as @EricIO mentioned, it is hard to recreate the issue, It seems this happens during parsing of DNS response records , I see packet capture during this overflow error, Wireshark says DNS packets are completely fine and contain up to 15 resource records in DNS response packet .
When wireshark says a packet is proper, how does the DNS parser say overflow? This is the confusion .

@miekg
Copy link
Owner

miekg commented Jun 21, 2024

yes, this may turn up a bug or two in code, or not

@bkr-JNPR
Copy link

bkr-JNPR commented Jul 2, 2024

@EricIO /@miekg,
any update on the patch for this issue ?

@EricIO
Copy link
Author

EricIO commented Jul 2, 2024

@bkr-JNPR Had some stuff come up so haven't had time to work on finishing it. Hopefully will soon.

@bkr-JNPR
Copy link

bkr-JNPR commented Jul 3, 2024

@EricIO ,
Thanks. I hope you will make the change as soon as possible, don't want to duplicate the work .

@EricIO
Copy link
Author

EricIO commented Jul 10, 2024

I'm currently working on the generated code to get that in a nice format. Will be on vacation a couple days so no progress will be made until I get back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants