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

Panic during outline tree validation #798

Closed
liron-l opened this issue Feb 7, 2024 · 5 comments
Closed

Panic during outline tree validation #798

liron-l opened this issue Feb 7, 2024 · 5 comments
Assignees
Labels

Comments

@liron-l
Copy link

liron-l commented Feb 7, 2024

The following code panics:

if count == nil || *count == 0 {
			if xRefTable.ValidationMode == model.ValidationStrict {
				return errors.New("pdfcpu: validateOutlineTree: non-empty outline item dict needs \"Count\" <> 0")
			}
			*count = c
		}

count is nil hence *c will panic.

@hhrutter
Copy link
Collaborator

hhrutter commented Feb 8, 2024

Thanks for discovering this!

@hhrutter hhrutter changed the title Library panic on malformed PDF Panic during outline tree validation Feb 8, 2024
@hhrutter
Copy link
Collaborator

Hi, can you share a file where this actually happens? ..because it shouldn't.
Would be very helpful for debugging and fixing this.
Thank you!

@makeitraina
Copy link

Hi, can you share a file where this actually happens? ..because it shouldn't. Would be very helpful for debugging and fixing this. Thank you!

Hi hhrutter, I also experienced this issue. I cant share the file because it has some confidential information. I made a fork with a simple change to add:

if count == nil {
   count = new(int)
}

Curious if you think this change will suffice here.

@hhrutter
Copy link
Collaborator

hhrutter commented Feb 18, 2024

We need an actual PDF in order to get to the root of this.

@hhrutter
Copy link
Collaborator

This should be fixed with latest commit!

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

No branches or pull requests

3 participants