-
-
Notifications
You must be signed in to change notification settings - Fork 579
Closed
Labels
Description
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:
pdfcpu/pkg/pdfcpu/types/streamdict.go
Line 432 in ce09a83
| return osd.ObjArray[index], nil |
The check above should be changed from
pdfcpu/pkg/pdfcpu/types/streamdict.go
Line 429 in ce09a83
| 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.