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

panic: interface conversion: pdf.PdfObject is nil, not *pdf.PdfObjectInteger #77

Closed
Metalnem opened this Issue Jul 20, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Metalnem

Metalnem commented Jul 20, 2017

Calling pdf.NewPdfReader on this malformed PDF file panics with the following message:

panic: interface conversion: pdf.PdfObject is nil, not *pdf.PdfObjectInteger

Stack trace:

goroutine 1 [running]:
github.com/unidoc/unidoc/pdf.(*PdfParser).decodeStream(0xc420018640, 0xc420015110, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/Metalnem/Go/src/github.com/unidoc/unidoc/pdf/pdfstream.go:58 +0x2b18
github.com/unidoc/unidoc/pdf.(*PdfParser).parseXrefStream(0xc420018640, 0x0, 0x12, 0xc420010f30, 0x1)
	/Users/Metalnem/Go/src/github.com/unidoc/unidoc/pdf/pdfparser.go:832 +0x4e3
github.com/unidoc/unidoc/pdf.(*PdfParser).parseXref(0xc420018640, 0x1000, 0x1000, 0xc4200be000)
	/Users/Metalnem/Go/src/github.com/unidoc/unidoc/pdf/pdfparser.go:991 +0x1fc
github.com/unidoc/unidoc/pdf.(*PdfParser).loadXrefs(0xc420018640, 0x0, 0xc420014de0, 0x0)
	/Users/Metalnem/Go/src/github.com/unidoc/unidoc/pdf/pdfparser.go:1093 +0x98d
github.com/unidoc/unidoc/pdf.NewParser(0x1233b80, 0xc42000e0e0, 0xc420014db0, 0x0, 0xc420014db0)
	/Users/Metalnem/Go/src/github.com/unidoc/unidoc/pdf/pdfparser.go:1298 +0xc8
github.com/unidoc/unidoc/pdf.NewPdfReader(0x1233b80, 0xc42000e0e0, 0xc42000e0e0, 0x0, 0x0)
	/Users/Metalnem/Go/src/github.com/unidoc/unidoc/pdf/reader.go:37 +0xa0
main.main()
	/Users/Metalnem/Go/src/github.com/metalnem/unifuzz/main.go:19 +0x102
exit status 2

This bug was found with the help of go-fuzz.

@Metalnem

This comment has been minimized.

Show comment
Hide comment
@Metalnem

Metalnem Jul 20, 2017

Fixed in v2.

Metalnem commented Jul 20, 2017

Fixed in v2.

@Metalnem Metalnem closed this Jul 20, 2017

@Metalnem

This comment has been minimized.

Show comment
Hide comment
@Metalnem

Metalnem Jul 20, 2017

Actually, this still exists in v2, it just takes a different input to trigger it. Here is another file that will cause the same panic in v2.

Metalnem commented Jul 20, 2017

Actually, this still exists in v2, it just takes a different input to trigger it. Here is another file that will cause the same panic in v2.

@Metalnem Metalnem reopened this Jul 20, 2017

@gunnsth gunnsth added the bug label Jul 20, 2017

@gunnsth gunnsth closed this in 1769c68 Jul 25, 2017

@gunnsth gunnsth modified the milestone: v2.0.1 Aug 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment