Skip to content

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

@EricIO

Description

@EricIO

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)
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions