diff --git a/internal/ccittfax/encoder.go b/internal/ccittfax/encoder.go index a8ac5e5e..97cf2daf 100644 --- a/internal/ccittfax/encoder.go +++ b/internal/ccittfax/encoder.go @@ -412,6 +412,11 @@ func seekChangingElem(row []byte, currElem int) int { if currElem >= len(row) { return currElem } + if currElem < -1 { + // A current element of -1 means white color starting prior to first element (0). + // Should not be able to go any further left than that. + currElem = -1 + } var color byte if currElem > -1 {