Skip to content

Commit

Permalink
Merge pull request #231 from NeomindLabs/master
Browse files Browse the repository at this point in the history
Add guard to prevent nil error while parsing octal notation
  • Loading branch information
boazsegev authored Oct 19, 2023
2 parents 308b41a + 7082a8c commit 23b4478
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/combine_pdf/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@ def _parse_
str << 12
when 48..57 # octal notation for byte?
rep -= 48
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57)
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57) && (((rep << 3) + (str_bytes[0] - 48)) <= 255)
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0]&.between?(48, 57)
rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0]&.between?(48, 57) && (((rep << 3) + (str_bytes[0] - 48)) <= 255)
str << rep
when 10 # new line, ignore
str_bytes.shift if str_bytes[0] == 13
Expand Down

0 comments on commit 23b4478

Please sign in to comment.