pdf-reader 2.4.1 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/lib/pdf/reader/filter/flate.rb +24 -13
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6772a9ffb17b04eaa3c77f2a7e9838a432ecd78506a75cb263f0056d1ace4ec8
|
4
|
+
data.tar.gz: 115a94c5b0c8a5367933c438511ec05e2110aaca5589c35a00e6ca76886fa85c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0bf877470670dd5c0d0cc061fcf1d9ad1f3ec687e66981806c023b9f270719c9045eeebf8c9ffecf07e45102a383438b1f52edb9bb215fea45d51e29aec8f62
|
7
|
+
data.tar.gz: bcf0f0bd8baab728d87e5031fd27eaf5386abfbd6111f06e1b7da3232400aed8f93a65675197451329aab6c503f19a5f378af80bc0659018f7dc246da3cb42ea
|
data/CHANGELOG
CHANGED
@@ -9,6 +9,7 @@ class PDF::Reader
|
|
9
9
|
# implementation of the Flate (zlib) stream filter
|
10
10
|
class Flate
|
11
11
|
ZLIB_AUTO_DETECT_ZLIB_OR_GZIP = 47 # Zlib::MAX_WBITS + 32
|
12
|
+
ZLIB_RAW_DEFLATE = -15 # Zlib::MAX_WBITS * -1
|
12
13
|
|
13
14
|
def initialize(options = {})
|
14
15
|
@options = options
|
@@ -17,24 +18,34 @@ class PDF::Reader
|
|
17
18
|
################################################################################
|
18
19
|
# Decode the specified data with the Zlib compression algorithm
|
19
20
|
def filter(data)
|
20
|
-
deflated =
|
21
|
+
deflated = zlib_inflate(data) || zlib_inflate(data[0, data.bytesize-1])
|
22
|
+
|
23
|
+
if deflated.nil?
|
24
|
+
raise MalformedPDFError,
|
25
|
+
"Error while inflating a compressed stream (no suitable inflation algorithm found)"
|
26
|
+
end
|
27
|
+
Depredict.new(@options).filter(deflated)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def zlib_inflate(data)
|
21
33
|
begin
|
22
|
-
|
34
|
+
return Zlib::Inflate.new(ZLIB_AUTO_DETECT_ZLIB_OR_GZIP).inflate(data)
|
23
35
|
rescue Zlib::DataError => e
|
24
36
|
# by default, Ruby's Zlib assumes the data it's inflating
|
25
37
|
# is RFC1951 deflated data, wrapped in a RFC1950 zlib container. If that
|
26
|
-
# fails,
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# See
|
30
|
-
# - http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/243545
|
31
|
-
deflated = Zlib::Inflate.new(-Zlib::MAX_WBITS).inflate(data)
|
38
|
+
# fails, swallow the exception and attempt to inflate the data as a raw
|
39
|
+
# RFC1951 stream.
|
32
40
|
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
|
42
|
+
begin
|
43
|
+
return Zlib::Inflate.new(ZLIB_RAW_DEFLATE).inflate(data)
|
44
|
+
rescue StandardError => e
|
45
|
+
# swallow this one too, so we can try some other fallback options
|
46
|
+
end
|
47
|
+
|
48
|
+
nil
|
38
49
|
end
|
39
50
|
end
|
40
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdf-reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Healy
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0
|
103
|
+
version: '1.0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: ruby-rc4
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -277,10 +277,10 @@ licenses:
|
|
277
277
|
- MIT
|
278
278
|
metadata:
|
279
279
|
bug_tracker_uri: https://github.com/yob/pdf-reader/issues
|
280
|
-
changelog_uri: https://github.com/yob/pdf-reader/blob/v2.4.
|
281
|
-
documentation_uri: https://www.rubydoc.info/gems/pdf-reader/2.4.
|
282
|
-
source_code_uri: https://github.com/yob/pdf-reader/tree/v2.4.
|
283
|
-
post_install_message:
|
280
|
+
changelog_uri: https://github.com/yob/pdf-reader/blob/v2.4.2/CHANGELOG
|
281
|
+
documentation_uri: https://www.rubydoc.info/gems/pdf-reader/2.4.2
|
282
|
+
source_code_uri: https://github.com/yob/pdf-reader/tree/v2.4.2
|
283
|
+
post_install_message:
|
284
284
|
rdoc_options:
|
285
285
|
- "--title"
|
286
286
|
- PDF::Reader Documentation
|
@@ -300,8 +300,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
300
300
|
- !ruby/object:Gem::Version
|
301
301
|
version: '0'
|
302
302
|
requirements: []
|
303
|
-
rubygems_version: 3.
|
304
|
-
signing_key:
|
303
|
+
rubygems_version: 3.2.3
|
304
|
+
signing_key:
|
305
305
|
specification_version: 4
|
306
306
|
summary: A library for accessing the content of PDF files
|
307
307
|
test_files: []
|