mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-04 22:17:22 +08:00
Add check for ID array length
This commit is contained in:
parent
9ff2413609
commit
3639b5c279
@ -292,7 +292,7 @@ func PdfCryptMakeNew(parser *PdfParser, ed, trailer *PdfObjectDictionary) (PdfCr
|
||||
// Strictly, if file is encrypted, the ID should always be specified
|
||||
// but clearly not everyone is following the specification.
|
||||
id0 := PdfObjectString("")
|
||||
if idArray, ok := trailer.Get("ID").(*PdfObjectArray); ok {
|
||||
if idArray, ok := trailer.Get("ID").(*PdfObjectArray); ok && len(*idArray) >= 1 {
|
||||
id0obj, ok := (*idArray)[0].(*PdfObjectString)
|
||||
if !ok {
|
||||
return crypter, errors.New("Invalid trailer ID")
|
||||
|
Loading…
x
Reference in New Issue
Block a user