Skip to content

Commit

Permalink
fix: ensure the matrix is square when decoding QR Code
Browse files Browse the repository at this point in the history
  • Loading branch information
soya-daizu committed Jun 4, 2023
1 parent 6a27ed0 commit 3cff113
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/goban/qr/decoder.cr
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct Goban::QR < Goban::AbstractQR
end

def decode(matrix : Matrix(UInt8))
raise InputError.new("Matrix not square") unless matrix.size_x == matrix.size_y

version = self.read_version(matrix)
mask, ecl = self.read_format(matrix)

Expand Down

0 comments on commit 3cff113

Please sign in to comment.