Skip to content

panic: runtime error: index out of range in ObjectStreamDict.IndexedObject() #1116

@fancycode

Description

@fancycode

Thank you for submitting a possible bug!

Please ensure the following:

  • Your issue is based on the latest commit

yes

  • State your OS and OS version

Ubuntu 20.04 (but doesn't matter)

  • When reporting a problem with a specific PDF input file please avoid stating the organization responsible for the PDFWriter - just refer to the PDFWriter

General issue.

The access to the indexed object inside the ObjectStreamDict will cause a panic if the index is outside the range of ObjArray here:

return osd.ObjArray[index], nil

The check above should be changed from

if osd.ObjArray == nil {

to

if index < 0 || index >= len(osd.ObjArray) {

This will then no longer cause a panic when such invalid files are parsed but make sure a proper error is returned.

Happy to prepare a PR to change this if you are interested.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions