Skip to content

Commit

Permalink
Check to ensure row length cannot be greater than data length. Fixes
Browse files Browse the repository at this point in the history
…#88.
  • Loading branch information
Gunnsteinn Hall authored and Gunnsteinn Hall committed Jul 31, 2017
1 parent 416eb89 commit 5bc9d83
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pdf/core/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,10 @@ func (this *LZWEncoder) DecodeStream(streamObj *PdfObjectStream) ([]byte, error)
if len(outData)%rowLength != 0 {
return nil, fmt.Errorf("Invalid row length (%d/%d)", len(outData), rowLength)
}
if rowLength > len(outData) {
common.Log.Trace("Row length cannot be longer than data length (%d/%d)", rowLength, len(outData))
return nil, errors.New("Range check error")
}

pOutBuffer := bytes.NewBuffer(nil)

Expand Down

0 comments on commit 5bc9d83

Please sign in to comment.