image_processing 2.0.3 → 2.1.0
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.md +5 -1
- data/lib/image_processing/mini_magick.rb +18 -5
- data/lib/image_processing/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a52c42f1463cc15caf0dfe57bc8a5efeb464006a2a29bbf1b8c842ada339e4aa
|
|
4
|
+
data.tar.gz: 2344e1015b02f4b24363371d8877bdcc4fb28b9fb820e15d2e2446f7874443c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 90c29ed45d475cc54f814a368e894504f5bc012835ef989d3678568dfb3cd29aca144e88cb17d102ffc82dcbd94c4d46de7d9a5fbc0474c0f6b15c481a1f4bb3
|
|
7
|
+
data.tar.gz: 8a7f991cf00725e1d5618add34f9b57814e2e273d8b9575f49e61701e80259ac8c2cd61028cdaefc6b4a6694a8a922d2246f5f6b8f7ee7184ff31bd0f8644813
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
## 2.0
|
|
1
|
+
## 2.1.0 (2026-09-01)
|
|
2
|
+
|
|
3
|
+
* [minimagick] Add `inherit_fds:` so a loader can name an already-open input (thanks to @flavorjones)
|
|
4
|
+
|
|
5
|
+
## 2.0.3 (2026-08-06)
|
|
2
6
|
|
|
3
7
|
* Prevent remote code execution when operation names come from user input, closing bypasses through the `#operation` meta-builder, `#method_missing`, and nested `#send` calls (reported by @szymonsec)
|
|
4
8
|
|
|
@@ -9,11 +9,20 @@ module ImageProcessing
|
|
|
9
9
|
module MiniMagick
|
|
10
10
|
extend Chainable
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
# mini_magick gained `inherit_fds:` on MiniMagick::Shell#execute in 5.4.0.
|
|
13
|
+
INHERIT_FDS_MINIMUM_VERSION = Gem::Version.new("5.4.0")
|
|
14
|
+
|
|
15
|
+
def self.convert_shim(inherit_fds: nil, &block)
|
|
16
|
+
if inherit_fds && ::MiniMagick.version < INHERIT_FDS_MINIMUM_VERSION
|
|
17
|
+
raise LoadError, "The `inherit_fds` loader option requires mini_magick #{INHERIT_FDS_MINIMUM_VERSION} or newer, but mini_magick #{::MiniMagick.version} is loaded. Please upgrade the gem."
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
options = inherit_fds ? { inherit_fds: inherit_fds } : {}
|
|
21
|
+
|
|
13
22
|
if ::MiniMagick.respond_to?(:convert)
|
|
14
|
-
::MiniMagick.convert(&block)
|
|
23
|
+
::MiniMagick.convert(**options, &block)
|
|
15
24
|
else
|
|
16
|
-
::MiniMagick::Tool::Convert.new(&block)
|
|
25
|
+
::MiniMagick::Tool::Convert.new(**options, &block)
|
|
17
26
|
end
|
|
18
27
|
end
|
|
19
28
|
|
|
@@ -37,12 +46,16 @@ module ImageProcessing
|
|
|
37
46
|
# Initializes the image on disk into a MiniMagick::Tool object. Accepts
|
|
38
47
|
# additional options related to loading the image (e.g. geometry).
|
|
39
48
|
# Additionally auto-orients the image to be upright.
|
|
40
|
-
|
|
49
|
+
# `inherit_fds` names IO objects the tool inherits, so the source may be a
|
|
50
|
+
# `/dev/fd/N` path. The source stays a path, so `loader`, `page` and
|
|
51
|
+
# `geometry` still apply to it, which they would not if the caller passed
|
|
52
|
+
# a pre-built MiniMagick::Tool carrying the descriptor.
|
|
53
|
+
def self.load_image(path_or_magick, loader: nil, page: nil, geometry: nil, auto_orient: true, inherit_fds: nil, **options)
|
|
41
54
|
if path_or_magick.is_a?(::MiniMagick::Tool)
|
|
42
55
|
magick = path_or_magick
|
|
43
56
|
else
|
|
44
57
|
source_path = path_or_magick
|
|
45
|
-
magick = ::ImageProcessing::MiniMagick.convert_shim
|
|
58
|
+
magick = ::ImageProcessing::MiniMagick.convert_shim(inherit_fds: inherit_fds)
|
|
46
59
|
|
|
47
60
|
Utils.apply_options(magick, **options)
|
|
48
61
|
|