diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..38ec151 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.0.3 diff --git a/lib/combine_pdf/parser.rb b/lib/combine_pdf/parser.rb index 27c06d4..a3a0d69 100644 --- a/lib/combine_pdf/parser.rb +++ b/lib/combine_pdf/parser.rb @@ -363,7 +363,11 @@ def _parse_ # advance by the publshed stream length (if any) old_pos = @scanner.pos if(out.last.is_a?(Hash) && out.last[:Length].is_a?(Integer) && out.last[:Length] > 2) - @scanner.pos += out.last[:Length] - 2 + begin + @scanner.pos += out.last[:Length] - 2 + rescue RangeError + # do nothing + end end # the following was dicarded because some PDF files didn't have an EOL marker as required