hexapdf 0.15.4 → 0.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/lib/hexapdf/cli/command.rb +1 -1
- data/lib/hexapdf/parser.rb +2 -2
- data/lib/hexapdf/tokenizer.rb +5 -4
- data/lib/hexapdf/version.rb +1 -1
- data/test/hexapdf/common_tokenizer_tests.rb +6 -2
- data/test/hexapdf/test_writer.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aa5d94e3b69f1d7b2b369d248664c2c4d96d13306c1fbb1cf0960412f129faf
|
4
|
+
data.tar.gz: f6e8ae5f61de78c41fecace64d0ad5d42f8c46032e6ac6550c01b2fb43109fe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49f3b3aee754308956df811f564d127269e8e1dbfc613bed39e42bd77303855b80fe11c2ade362cef174838b58188470b5604e2d2c930dcf7637e7600410ac15
|
7
|
+
data.tar.gz: 3a4d5555ae6f012176aebe0a29c36500ad20f385a342c27819f5db3a0e8c5e270c58526c8434b8c8d98c59b963721a51344e93bfc6d51f3eab4fc76cceeb830e
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
## 0.15.5 - 2021-07-06
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
|
5
|
+
* Refactored [HexaPDF::Tokenizer#next_xref_entry] and changed yielded value
|
6
|
+
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
* Handling of invalid cross-reference stream entries that ends with the sequence
|
11
|
+
`\r\r`
|
12
|
+
|
13
|
+
|
1
14
|
## 0.15.4 - 2021-05-27
|
2
15
|
|
3
16
|
### Fixed
|
data/lib/hexapdf/cli/command.rb
CHANGED
@@ -50,7 +50,7 @@ module HexaPDF
|
|
50
50
|
module Extensions #:nodoc:
|
51
51
|
def help_banner #:nodoc:
|
52
52
|
"hexapdf #{HexaPDF::VERSION} - Versatile PDF Manipulation Tool\n" \
|
53
|
-
"Copyright (c) 2014-
|
53
|
+
"Copyright (c) 2014-2021 Thomas Leitner; licensed under the AGPLv3\n\n" \
|
54
54
|
"#{format(usage, indent: 7)}\n\n"
|
55
55
|
end
|
56
56
|
end
|
data/lib/hexapdf/parser.rb
CHANGED
@@ -263,9 +263,9 @@ module HexaPDF
|
|
263
263
|
|
264
264
|
@tokenizer.skip_whitespace
|
265
265
|
start.upto(start + number_of_entries - 1) do |oid|
|
266
|
-
pos, gen, type = @tokenizer.next_xref_entry do |
|
266
|
+
pos, gen, type = @tokenizer.next_xref_entry do |recoverable|
|
267
267
|
maybe_raise("Invalid cross-reference entry", pos: @tokenizer.pos,
|
268
|
-
force: !
|
268
|
+
force: !recoverable)
|
269
269
|
end
|
270
270
|
if xref.entry?(oid)
|
271
271
|
next
|
data/lib/hexapdf/tokenizer.rb
CHANGED
@@ -225,13 +225,14 @@ module HexaPDF
|
|
225
225
|
# Reads the cross-reference subsection entry at the current position and advances the scan
|
226
226
|
# pointer.
|
227
227
|
#
|
228
|
-
# If a
|
228
|
+
# If a problem is detected, yields to caller where the argument +recoverable+ is truthy if the
|
229
|
+
# problem is recoverable.
|
229
230
|
#
|
230
231
|
# See: PDF1.7 7.5.4
|
231
|
-
def next_xref_entry #:yield:
|
232
|
+
def next_xref_entry #:yield: recoverable
|
232
233
|
prepare_string_scanner(20)
|
233
|
-
|
234
|
-
yield(@ss
|
234
|
+
if !@ss.skip(/(\d{10}) (\d{5}) ([nf])(?: \r| \n|\r\n|(\r\r|\r|\n))/) || @ss[4]
|
235
|
+
yield(@ss[4])
|
235
236
|
end
|
236
237
|
[@ss[1].to_i, @ss[2].to_i, @ss[3]]
|
237
238
|
end
|
data/lib/hexapdf/version.rb
CHANGED
@@ -210,8 +210,12 @@ module CommonTokenizerTests
|
|
210
210
|
|
211
211
|
it "next_xref_entry: fails on invalidly formatted entries" do
|
212
212
|
create_tokenizer("0000000001 00001 g \n")
|
213
|
-
assert_raises(RuntimeError) { @tokenizer.next_xref_entry { raise } }
|
213
|
+
assert_raises(RuntimeError) { @tokenizer.next_xref_entry {|recoverable| refute(recoverable); raise } }
|
214
214
|
create_tokenizer("0000000001 00001 n\n")
|
215
|
-
assert_raises(RuntimeError) { @tokenizer.next_xref_entry { raise } }
|
215
|
+
assert_raises(RuntimeError) { @tokenizer.next_xref_entry {|recoverable| assert(recoverable); raise } }
|
216
|
+
create_tokenizer("0000000001 00001 n\r")
|
217
|
+
assert_raises(RuntimeError) { @tokenizer.next_xref_entry {|recoverable| assert(recoverable); raise } }
|
218
|
+
create_tokenizer("0000000001 00001 n\r\r")
|
219
|
+
assert_raises(RuntimeError) { @tokenizer.next_xref_entry {|recoverable| assert(recoverable); raise } }
|
216
220
|
end
|
217
221
|
end
|
data/test/hexapdf/test_writer.rb
CHANGED
@@ -40,7 +40,7 @@ describe HexaPDF::Writer do
|
|
40
40
|
219
|
41
41
|
%%EOF
|
42
42
|
3 0 obj
|
43
|
-
<</Producer(HexaPDF version 0.15.
|
43
|
+
<</Producer(HexaPDF version 0.15.5)>>
|
44
44
|
endobj
|
45
45
|
xref
|
46
46
|
3 1
|
@@ -72,7 +72,7 @@ describe HexaPDF::Writer do
|
|
72
72
|
141
|
73
73
|
%%EOF
|
74
74
|
6 0 obj
|
75
|
-
<</Producer(HexaPDF version 0.15.
|
75
|
+
<</Producer(HexaPDF version 0.15.5)>>
|
76
76
|
endobj
|
77
77
|
2 0 obj
|
78
78
|
<</Length 10>>stream
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexapdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|