Skip to content

Commit

Permalink
fix(read): correctly use logic operator in header condition
Browse files Browse the repository at this point in the history
  • Loading branch information
lzambarda committed Mar 15, 2022
1 parent 0c2507a commit 7dfab7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion read.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func NewReader(f io.ReaderAt, size int64) (*Reader, error) {
func NewReaderEncrypted(f io.ReaderAt, size int64, pw func() string) (*Reader, error) {
buf := make([]byte, 10)
f.ReadAt(buf, 0)
if !bytes.HasPrefix(buf, []byte("%PDF-1.")) || buf[7] < '0' || buf[7] > '7' || buf[8] != '\r' && buf[8] != '\n' {
if !bytes.HasPrefix(buf, []byte("%PDF-1.")) || buf[7] < '0' || buf[7] > '7' || buf[8] != '\r' || buf[8] != '\n' {
return nil, fmt.Errorf("not a PDF file: invalid header")
}
end := size
Expand Down

0 comments on commit 7dfab7e

Please sign in to comment.