rmagick 7.1.2 → 7.1.4
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 +24 -0
- data/ext/RMagick/rmagick.cpp +6 -6
- data/ext/RMagick/rmimage.cpp +28 -7
- data/lib/rmagick/version.rb +1 -1
- data/lib/rmagick_internal.rb +19 -7
- 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: a5c3f56f5b39c2f505f37875134e7af86904393036c531e6074f2796939f204c
|
|
4
|
+
data.tar.gz: 3bf4833ad9aa56f93e1d2426bd6c72b95c54e0c2c8dcd2c4248f62635bf7606e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff12f7c040309d906c8ba517cc4a10c472019c0b99d718f470f24b804021dd2a431b4fd876a59e0c18eb8acbb8edac0eb2e15b68826a8ba11779e62e5894a202
|
|
7
|
+
data.tar.gz: 06dfb967d7de90cdc6791dcbb2e9fc6b5ece9ccef12e53b3588ea96c09960e28cd938b9f982654ccd95c6f765cd65a1fae179e3c230d14f4548511d851f36de8
|
data/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
|
6
|
+
## RMagick 7.1.4
|
|
7
|
+
|
|
8
|
+
> [!IMPORTANT]
|
|
9
|
+
> Four kinds of input that used to be accepted now raise `ArgumentError`.
|
|
10
|
+
>
|
|
11
|
+
> Three of them were ways for a string RMagick documents as a value to be read back as part of an ImageMagick program: an opacity of `"1%\nimage Over 0,0 80,80 'secret.png'\n1%"`, a `Draw#pattern` name carrying the same payload, and a `Caption` property of `"@/etc/passwd"` arriving in the metadata of an uploaded image. ImageMagick executed the injected primitive, or read the named file and drew its contents into the returned image. `Image#dispatch` is the fourth: a `map` containing a NUL byte is now rejected rather than sized with the byte length while ImageMagick fills only what precedes the NUL.
|
|
12
|
+
>
|
|
13
|
+
> `Image#export_pixels_to_str` with `Magick::LongPixel` also returns half as many bytes on LP64, and `Image#import_pixels` takes a buffer of that size. RMagick reserved `sizeof(unsigned long)` per element while ImageMagick reads and writes `unsigned int`, so the second half of the string was never written and carried whatever the heap held. `Image#colormap` returned uninitialized memory the same way, as the previous colour of an entry it had just created.
|
|
14
|
+
|
|
15
|
+
Breaking Changes
|
|
16
|
+
|
|
17
|
+
* Reject an opacity percentage that is not a plain number from 0% to 100% (#1867)
|
|
18
|
+
* Restrict a Draw#pattern name to letters, digits, hyphen, period and underscore (#1869)
|
|
19
|
+
* Return LongPixel pixel data as unsigned int, without the uninitialized padding Image#export_pixels_to_str used to append (#1870)
|
|
20
|
+
* Reject a Caption property beginning with '@' in Image#polaroid instead of reading that file (#1871)
|
|
21
|
+
|
|
22
|
+
## RMagick 7.1.3
|
|
23
|
+
|
|
24
|
+
Bug Fixes
|
|
25
|
+
|
|
26
|
+
* Fix Magick.set_cache_threshold truncating the threshold on 32-bit platforms (#1865)
|
|
27
|
+
* Fix Magick.limit_resource truncating 64-bit limits on 32-bit platforms (#1864)
|
|
28
|
+
|
|
6
29
|
## RMagick 7.1.2
|
|
7
30
|
|
|
8
31
|
Bug Fixes
|
|
@@ -10,6 +33,7 @@ Bug Fixes
|
|
|
10
33
|
* Fix memory leak in Draw#annotate when the geometry copy fails (#1854)
|
|
11
34
|
* Fix affine matrix not being restored when Draw#annotate raises (#1853)
|
|
12
35
|
* Fix use-after-free in Draw#annotate when a callback destroys the image (#1852)
|
|
36
|
+
* Fix Steep self type crash in RVG helper (#1851)
|
|
13
37
|
* Fix memory leak in Draw#annotate when a geometry argument raises (#1850)
|
|
14
38
|
|
|
15
39
|
## RMagick 7.1.1
|
data/ext/RMagick/rmagick.cpp
CHANGED
|
@@ -217,7 +217,7 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
|
|
|
217
217
|
ResourceType res = UndefinedResource;
|
|
218
218
|
char *str;
|
|
219
219
|
ID id;
|
|
220
|
-
|
|
220
|
+
MagickSizeType cur_limit;
|
|
221
221
|
|
|
222
222
|
rb_scan_args(argc, argv, "11", &resource, &limit);
|
|
223
223
|
|
|
@@ -301,12 +301,12 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
|
|
|
301
301
|
|
|
302
302
|
if (argc > 1)
|
|
303
303
|
{
|
|
304
|
-
SetMagickResourceLimit(res, (MagickSizeType)
|
|
304
|
+
SetMagickResourceLimit(res, (MagickSizeType)NUM2ULL(limit));
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
RB_GC_GUARD(limit);
|
|
308
308
|
|
|
309
|
-
return
|
|
309
|
+
return ULL2NUM(cur_limit);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
|
|
@@ -320,9 +320,9 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
|
|
|
320
320
|
VALUE
|
|
321
321
|
Magick_set_cache_threshold(VALUE klass, VALUE threshold)
|
|
322
322
|
{
|
|
323
|
-
|
|
324
|
-
SetMagickResourceLimit(MemoryResource,
|
|
325
|
-
SetMagickResourceLimit(MapResource,
|
|
323
|
+
MagickSizeType thrshld = (MagickSizeType)NUM2ULL(threshold);
|
|
324
|
+
SetMagickResourceLimit(MemoryResource, thrshld);
|
|
325
|
+
SetMagickResourceLimit(MapResource, 2*thrshld);
|
|
326
326
|
return klass;
|
|
327
327
|
}
|
|
328
328
|
|
data/ext/RMagick/rmimage.cpp
CHANGED
|
@@ -3295,7 +3295,7 @@ Image_colormap(int argc, VALUE *argv, VALUE self)
|
|
|
3295
3295
|
image->colormap = (PixelColor *)magick_safe_realloc(image->colormap, (idx+1), sizeof(PixelColor));
|
|
3296
3296
|
}
|
|
3297
3297
|
|
|
3298
|
-
for (i = image->colors; i
|
|
3298
|
+
for (i = image->colors; i <= idx; i++)
|
|
3299
3299
|
{
|
|
3300
3300
|
image->colormap[i] = black;
|
|
3301
3301
|
}
|
|
@@ -5758,7 +5758,8 @@ Image_dispatch(int argc, VALUE *argv, VALUE self)
|
|
|
5758
5758
|
y = NUM2LONG(argv[1]);
|
|
5759
5759
|
columns = NUM2ULONG(argv[2]);
|
|
5760
5760
|
rows = NUM2ULONG(argv[3]);
|
|
5761
|
-
map =
|
|
5761
|
+
map = StringValueCStr(argv[4]);
|
|
5762
|
+
mapL = strlen(map);
|
|
5762
5763
|
if (argc == 6)
|
|
5763
5764
|
{
|
|
5764
5765
|
stg_type = RTEST(argv[5]) ? DoublePixel : QuantumPixel;
|
|
@@ -6903,7 +6904,7 @@ Image_export_pixels_to_str(int argc, VALUE *argv, VALUE self)
|
|
|
6903
6904
|
sz = sizeof(float);
|
|
6904
6905
|
break;
|
|
6905
6906
|
case LongPixel:
|
|
6906
|
-
sz = sizeof(unsigned
|
|
6907
|
+
sz = sizeof(unsigned int);
|
|
6907
6908
|
break;
|
|
6908
6909
|
case QuantumPixel:
|
|
6909
6910
|
sz = sizeof(Quantum);
|
|
@@ -8174,7 +8175,7 @@ Image_import_pixels(int argc, VALUE *argv, VALUE self)
|
|
|
8174
8175
|
type_sz = sizeof(unsigned short);
|
|
8175
8176
|
break;
|
|
8176
8177
|
case LongPixel:
|
|
8177
|
-
type_sz = sizeof(unsigned
|
|
8178
|
+
type_sz = sizeof(unsigned int);
|
|
8178
8179
|
break;
|
|
8179
8180
|
case DoublePixel:
|
|
8180
8181
|
type_sz = sizeof(double);
|
|
@@ -10867,7 +10868,8 @@ Image_pixel_interpolation_method_eq(VALUE self, VALUE method)
|
|
|
10867
10868
|
|
|
10868
10869
|
/**
|
|
10869
10870
|
* Produce an image that looks like a Polaroid instant picture. If the image has a "Caption"
|
|
10870
|
-
* property, the value is used as a caption.
|
|
10871
|
+
* property, the value is used as a caption. A caption whose first non-blank character is '@'
|
|
10872
|
+
* is rejected because ImageMagick reads the caption from the file it names.
|
|
10871
10873
|
*
|
|
10872
10874
|
* The following annotate attributes control the label rendering:
|
|
10873
10875
|
* align, decorate, density, encoding, fill, font, font_family, font_stretch, font_style,
|
|
@@ -10888,6 +10890,7 @@ Image_pixel_interpolation_method_eq(VALUE self, VALUE method)
|
|
|
10888
10890
|
* @yieldparam opt [Magick::Image::PolaroidOptions]
|
|
10889
10891
|
*
|
|
10890
10892
|
* @return [Magick::Image] a new image
|
|
10893
|
+
* @raise [ArgumentError] if the "Caption" property begins with '@'
|
|
10891
10894
|
*/
|
|
10892
10895
|
VALUE
|
|
10893
10896
|
Image_polaroid(int argc, VALUE *argv, VALUE self)
|
|
@@ -10897,9 +10900,7 @@ Image_polaroid(int argc, VALUE *argv, VALUE self)
|
|
|
10897
10900
|
double angle = -5.0;
|
|
10898
10901
|
Draw *draw;
|
|
10899
10902
|
ExceptionInfo *exception;
|
|
10900
|
-
#if defined(IMAGEMAGICK_7)
|
|
10901
10903
|
const char *caption;
|
|
10902
|
-
#endif
|
|
10903
10904
|
|
|
10904
10905
|
image = rm_check_destroyed(self);
|
|
10905
10906
|
|
|
@@ -10924,6 +10925,26 @@ Image_polaroid(int argc, VALUE *argv, VALUE self)
|
|
|
10924
10925
|
exception = AcquireExceptionInfo();
|
|
10925
10926
|
#if defined(IMAGEMAGICK_7)
|
|
10926
10927
|
caption = GetImageProperty(clone, "Caption", exception);
|
|
10928
|
+
#else
|
|
10929
|
+
caption = GetImageProperty(clone, "Caption");
|
|
10930
|
+
#endif
|
|
10931
|
+
if (caption)
|
|
10932
|
+
{
|
|
10933
|
+
const char *p = caption;
|
|
10934
|
+
|
|
10935
|
+
while (isspace((int) ((unsigned char) *p)))
|
|
10936
|
+
{
|
|
10937
|
+
p++;
|
|
10938
|
+
}
|
|
10939
|
+
if (*p == '@')
|
|
10940
|
+
{
|
|
10941
|
+
DestroyImage(clone);
|
|
10942
|
+
DestroyExceptionInfo(exception);
|
|
10943
|
+
rb_raise(rb_eArgError, "the Caption property must not begin with '@'");
|
|
10944
|
+
}
|
|
10945
|
+
}
|
|
10946
|
+
|
|
10947
|
+
#if defined(IMAGEMAGICK_7)
|
|
10927
10948
|
GVL_STRUCT_TYPE(PolaroidImage) args = { clone, draw->info, caption, angle, image->interpolate, exception };
|
|
10928
10949
|
new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(PolaroidImage), &args);
|
|
10929
10950
|
#else
|
data/lib/rmagick/version.rb
CHANGED
data/lib/rmagick_internal.rb
CHANGED
|
@@ -228,7 +228,12 @@ module Magick
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
def to_opacity(opacity)
|
|
231
|
-
|
|
231
|
+
if opacity.is_a?(String) && opacity.end_with?('%')
|
|
232
|
+
percentage = /\A(\d*\.?\d+(?:[eE][-+]?\d+)?)%\z/.match(opacity)
|
|
233
|
+
Kernel.raise ArgumentError, 'opacity must be a percentage between 0% and 100%' unless percentage && Float(percentage[1]) <= 100
|
|
234
|
+
|
|
235
|
+
return opacity
|
|
236
|
+
end
|
|
232
237
|
|
|
233
238
|
value = Float(opacity)
|
|
234
239
|
Kernel.raise ArgumentError, 'opacity must be >= 0 and <= 1.0' if value < 0 || value > 1.0
|
|
@@ -448,14 +453,21 @@ module Magick
|
|
|
448
453
|
# draw the pattern. Reference the pattern by using its name
|
|
449
454
|
# as the argument to the 'fill' or 'stroke' methods
|
|
450
455
|
def pattern(name, x, y, width, height)
|
|
456
|
+
name = to_string(name)
|
|
457
|
+
Kernel.raise ArgumentError, 'pattern name must consist of letters, digits, hyphen, period and underscore' unless /\A[\w.-]+\z/.match?(name)
|
|
458
|
+
|
|
459
|
+
viewport = sprintf('%g %g %g %g', x, y, width, height)
|
|
460
|
+
|
|
451
461
|
push('defs')
|
|
452
|
-
push("pattern #{
|
|
462
|
+
push("pattern #{name} " + viewport)
|
|
453
463
|
push('graphic-context')
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
464
|
+
begin
|
|
465
|
+
yield
|
|
466
|
+
ensure
|
|
467
|
+
pop('graphic-context')
|
|
468
|
+
pop('pattern')
|
|
469
|
+
pop('defs')
|
|
470
|
+
end
|
|
459
471
|
end
|
|
460
472
|
|
|
461
473
|
# Set point to fill color.
|