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
Closed

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

tr3ee opened this issue Sep 19, 2018 · 5 comments

Comments

@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
Copy link
Owner

miekg commented Sep 19, 2018 via email

@tr3ee
Copy link
Contributor Author

tr3ee commented Sep 21, 2018

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

@miekg
Copy link
Owner

miekg commented Sep 21, 2018 via email

@tr3ee tr3ee mentioned this issue Sep 22, 2018
@tr3ee
Copy link
Contributor Author

tr3ee commented Sep 22, 2018

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

miekg pushed a commit that referenced this issue Sep 22, 2018
* Fix error comparison in SetTA

* Add testcase TestParseTA()
@tmthrgd
Copy link
Collaborator

tmthrgd commented Sep 23, 2018

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

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