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

dns.ParseZone() parsing error leading to nil pointer dereference #742

Closed
tr3ee opened this Issue Sep 19, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@tr3ee
Copy link
Contributor

tr3ee commented Sep 19, 2018

What did I do?

PoC.go

package main

import (
	"fmt"
	"strings"

	"github.com/miekg/dns"
)

func main() {
	r := strings.NewReader(` Ta 0 0 0`)
	for x := range dns.ParseZone(r, "", "") {
		if x.Error != nil {
			fmt.Println(x.Error)
		} else if x == nil {
			// This should never be reached
			fmt.Println("x == NIL")
		} else {
			// Do something with x.RR
			fmt.Println(x.RR.String())
		}
	}
	return
}

What happened?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x65a762]

goroutine 1 [running]:
main.main()
	/path/to/gopath/src/fuzz/dns/worker/main.go:20 +0x122
exit status 2
@miekg

This comment has been minimized.

Copy link
Owner

miekg commented Sep 19, 2018

@tr3ee

This comment has been minimized.

Copy link
Contributor Author

tr3ee commented Sep 21, 2018

@miekg
I will take a look this tomorrow or a few day : )

@miekg

This comment has been minimized.

Copy link
Owner

miekg commented Sep 21, 2018

@tr3ee tr3ee referenced this issue Sep 22, 2018

Merged

Fix issue #742 #745

@tr3ee

This comment has been minimized.

Copy link
Contributor Author

tr3ee commented Sep 22, 2018

@miekg
A PR #745 has been sent, please review it

miekg added a commit that referenced this issue Sep 22, 2018

Fix issue #742 (#745)
* Fix error comparison in SetTA

* Add testcase TestParseTA()
@tmthrgd

This comment has been minimized.

Copy link
Collaborator

tmthrgd commented Sep 23, 2018

#745 didn't have the magic commit message that would have closed this issue.

@tmthrgd tmthrgd closed this Sep 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.