hexapdf 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTERS +1 -1
- data/VERSION +1 -1
- data/lib/hexapdf/encryption/standard_security_handler.rb +1 -1
- data/lib/hexapdf/type/object_stream.rb +5 -1
- data/lib/hexapdf/version.rb +1 -1
- data/test/hexapdf/test_writer.rb +2 -2
- data/test/hexapdf/type/test_object_stream.rb +47 -15
- 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: a1011a745720b76eaa963d0a54b6807e732fe6ecd3bcb029870309e42296bbe9
|
4
|
+
data.tar.gz: 0aed16b283825785a7039ebca11a61da853c7fb01e8d2fadc9e5d7a722e56754
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70bee8b172f67ab59559ec1b0d740d767dad0db0a5d30476bdbfd71f80f443b31fc8b98bfd62a6d632411c246aa04af9c4203c443f4affc7b0307694bd5b725b
|
7
|
+
data.tar.gz: 04002b0d6728a37c499c1453a4068161b6c3c2631e318981559e52207681ae268de39b6a5b9127b39ee009be079c06e8ea761c2633d1f586efb0294a923e7a61
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 0.9.3 - 2019-06-13
|
2
|
+
|
3
|
+
### Changed
|
4
|
+
|
5
|
+
* Behaviour of how object streams are generated to work around a bug (?) in
|
6
|
+
Adobe Acrobat
|
7
|
+
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
* Fix problem with [HexaPDF::Encryption::StandardSecurityHandler] due to
|
11
|
+
behaviour change of Ruby 2.6.0 in `String#setbyte`
|
12
|
+
|
1
13
|
## 0.9.2 - 2019-05-22
|
2
14
|
|
3
15
|
### Changed
|
data/CONTRIBUTERS
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.3
|
@@ -174,7 +174,11 @@ module HexaPDF
|
|
174
174
|
encrypt_dict = document.trailer[:Encrypt]
|
175
175
|
while index < objects.size / 2
|
176
176
|
obj = revision.object(objects[index])
|
177
|
-
|
177
|
+
|
178
|
+
# Due to a bug in Adobe Acrobat, the Catalog may not be in an object stream if the
|
179
|
+
# document is encrypted
|
180
|
+
if obj.nil? || obj.null? || obj.gen != 0 || obj.kind_of?(Stream) || obj == encrypt_dict ||
|
181
|
+
(encrypt_dict && obj.type == :Catalog)
|
178
182
|
delete_object(objects[index])
|
179
183
|
next
|
180
184
|
end
|
data/lib/hexapdf/version.rb
CHANGED
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.9.
|
43
|
+
<</Producer(HexaPDF version 0.9.3)>>
|
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.9.
|
75
|
+
<</Producer(HexaPDF version 0.9.3)>>
|
76
76
|
endobj
|
77
77
|
2 0 obj
|
78
78
|
<</Length 10>>stream
|
@@ -57,21 +57,53 @@ describe HexaPDF::Type::ObjectStream do
|
|
57
57
|
assert_nil(@obj.object_index(5))
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
60
|
+
describe "write objects to stream" do
|
61
|
+
before do
|
62
|
+
@revision = Object.new
|
63
|
+
def @revision.object(obj); obj; end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "processes allowed objects" do
|
67
|
+
@obj.add_object(HexaPDF::Object.new(5, oid: 1))
|
68
|
+
@obj.add_object(HexaPDF::Object.new([1, 2], oid: 5))
|
69
|
+
|
70
|
+
@obj.write_objects(@revision)
|
71
|
+
assert_equal(2, @obj.value[:N])
|
72
|
+
assert_equal(8, @obj.value[:First])
|
73
|
+
assert_equal("1 0 5 2 5 [1 2] ", @obj.stream)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "doesn't allow null objects" do
|
77
|
+
@obj.add_object(HexaPDF::Object.new(nil, oid: 7))
|
78
|
+
@obj.write_objects(@revision)
|
79
|
+
assert_equal(0, @obj.value[:N])
|
80
|
+
assert_equal(0, @obj.value[:First])
|
81
|
+
assert_equal("", @obj.stream)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "doesn't allow objects with gen not 0" do
|
85
|
+
@obj.add_object(HexaPDF::Object.new(:will_be_deleted, oid: 3, gen: 1))
|
86
|
+
@obj.write_objects(@revision)
|
87
|
+
assert_equal(0, @obj.value[:N])
|
88
|
+
assert_equal(0, @obj.value[:First])
|
89
|
+
assert_equal("", @obj.stream)
|
90
|
+
end
|
91
|
+
|
92
|
+
it "doesn't allow the encryption dictionary to be compressed" do
|
93
|
+
@obj.add_object(@doc.trailer[:Encrypt])
|
94
|
+
@obj.write_objects(@revision)
|
95
|
+
assert_equal(0, @obj.value[:N])
|
96
|
+
assert_equal(0, @obj.value[:First])
|
97
|
+
assert_equal("", @obj.stream)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "doesn't allow the Catalog entry to be compressed when encryption is used" do
|
101
|
+
@obj.add_object(HexaPDF::Dictionary.new({Type: :Catalog}, oid: 8))
|
102
|
+
@obj.write_objects(@revision)
|
103
|
+
assert_equal(0, @obj.value[:N])
|
104
|
+
assert_equal(0, @obj.value[:First])
|
105
|
+
assert_equal("", @obj.stream)
|
106
|
+
end
|
75
107
|
end
|
76
108
|
|
77
109
|
it "fails validation if gen != 0" do
|
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.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Leitner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cmdparse
|