Skip to content

Commit

Permalink
Allow array in DecodeParms in FlateDecoder of length 1 (containing di…
Browse files Browse the repository at this point in the history
…ct).
  • Loading branch information
Gunnsteinn Hall authored and Gunnsteinn Hall committed Aug 9, 2017
1 parent cc6883d commit d234fec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pdf/core/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,14 @@ func newFlateEncoderFromStream(streamObj *PdfObjectStream, decodeParams *PdfObje
if decodeParams == nil {
obj := TraceToDirectObject(encDict.Get("DecodeParms"))
if obj != nil {
if arr, isArr := obj.(*PdfObjectArray); isArr {
if len(*arr) != 1 {
common.Log.Debug("Error: DecodeParms array length != 1 (%d)", len(*arr))
return nil, errors.New("Range check error")
}
obj = TraceToDirectObject((*arr)[0])
}

dp, isDict := obj.(*PdfObjectDictionary)
if !isDict {
common.Log.Debug("Error: DecodeParms not a dictionary (%T)", obj)
Expand Down

0 comments on commit d234fec

Please sign in to comment.