rmagick 7.1.4 → 7.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5c3f56f5b39c2f505f37875134e7af86904393036c531e6074f2796939f204c
4
- data.tar.gz: 3bf4833ad9aa56f93e1d2426bd6c72b95c54e0c2c8dcd2c4248f62635bf7606e
3
+ metadata.gz: e308c3194e4a4a558c205843e22e8aa4a00435d18945b7d978e9c2a8a0d513c0
4
+ data.tar.gz: e1d208d02935f3fd02cd20cf7331806820b42729898e9a6117ec1fd19fb625e8
5
5
  SHA512:
6
- metadata.gz: ff12f7c040309d906c8ba517cc4a10c472019c0b99d718f470f24b804021dd2a431b4fd876a59e0c18eb8acbb8edac0eb2e15b68826a8ba11779e62e5894a202
7
- data.tar.gz: 06dfb967d7de90cdc6791dcbb2e9fc6b5ece9ccef12e53b3588ea96c09960e28cd938b9f982654ccd95c6f765cd65a1fae179e3c230d14f4548511d851f36de8
6
+ metadata.gz: 8e9921e35f07f25cf2341dfac5d386362be9991ba52fc587a4556692d1fd32f86d02138a2338919a753a90c49450a18af708cb937058ae4db47580528882482d
7
+ data.tar.gz: 2577bf2c6006d4322c0c5a304ea0fcc7b34c1bafcbcba16194d75417acc863c2cdb2ef0140230b7e756c948016477e1ca1c7c96c33fc94d45b76066785f965e0
data/CHANGELOG.md CHANGED
@@ -3,6 +3,51 @@
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.6
7
+
8
+ > [!IMPORTANT]
9
+ > A `Magick::KernelInfo` kernel string starting with `@` now raises `ArgumentError`.
10
+ >
11
+ > `KernelInfo.new`, and `Image#morphology` and `#morphology_channel` when given a string kernel, passed the string to ImageMagick, which reads the kernel from the file a string starting with `@` names. A kernel string taken from user input could therefore read any file the process can open: a file holding a kernel definition changed the result image, and with ImageMagick 7 the error told whether the path exists. The message is "the kernel must not name a file with '@'", as for the other values that reject `@`.
12
+
13
+ Breaking Changes
14
+
15
+ * Reject a KernelInfo kernel string beginning with '@' instead of reading that file (#1895)
16
+
17
+ Improvements
18
+
19
+ * Add Magick.resource_usage to read how much of a resource ImageMagick uses (#1880)
20
+ * Add the methods, classes and fields missing from the API reference, and fix the entries that disagreed with the code (#1881, #1883-#1891, #1893, #1897, #1899)
21
+
22
+ Bug Fixes
23
+
24
+ * Fix RBS signatures that disagree with the implementation (#1901)
25
+ * Fix clone of Image, Draw, Pixel, KernelInfo and ImageList rejecting the freeze keyword (#1900)
26
+ * Fix resample and resize sharpening the image at blur 1.0 with ImageMagick 7 (#1898)
27
+ * Fix KernelInfo.builtin leaving out ImageMagick's default arguments (#1896)
28
+ * Fix mutating a frozen Magick::KernelInfo and a leak in KernelInfo#initialize (#1894)
29
+ * Fix TypeMetric#underline_thickness returning the underline position (#1892)
30
+
31
+ ## RMagick 7.1.5
32
+
33
+ > [!IMPORTANT]
34
+ > More strings that ImageMagick would read from a file now raise `ArgumentError`.
35
+ >
36
+ > `Montage#title=` and the `caption`, `comment` and `label` options, set through `Info#caption=`, `#comment=`, `#label=` or `Info#[]=`, now reject a value whose first non-blank character is `@`, as `Image#polaroid` has done since 7.1.4. ImageMagick read the file it named and put its contents into the montage or into the metadata of the image being read. These checks and the one in `Image#polaroid` also reject a `%[fx:@...]`, `%[hex:@...]` or `%[pixel:@...]` escape, which ImageMagick 7 reads from the named file as well, and their message now says the value "must not name a file with '@'".
37
+ >
38
+ > `Image#profile!` now accepts only the profile formats of ImageMagick's META coder (8BIM, APP1, EXIF, ICC, ICM, IPTC, XMP and their variants) and raises `ArgumentError` for any other name. It decoded the profile with the coder of whatever name it was given, so a profile named `msl` copied from an uploaded image ran as an MSL script.
39
+
40
+ Breaking Changes
41
+
42
+ * Accept only META profile formats in Image#profile! instead of decoding the profile with the coder of that name (#1873)
43
+ * Reject a Montage#title beginning with '@' instead of reading that file (#1874)
44
+ * Reject an Info#caption, #comment or #label value beginning with '@' instead of reading that file (#1875)
45
+ * Also reject %[fx:@...], %[hex:@...] and %[pixel:@...] escapes where a value beginning with '@' is rejected (#1876)
46
+
47
+ Bug Fixes
48
+
49
+ * Fix stack buffer overflow in Image#inspect with a long format name (#1877)
50
+
6
51
  ## RMagick 7.1.4
7
52
 
8
53
  > [!IMPORTANT]
@@ -196,35 +196,24 @@ Magick_init_formats(VALUE klass ATTRIBUTE_UNUSED)
196
196
 
197
197
 
198
198
  /**
199
- * Get/set resource limits. If a limit is specified the old limit is set to the
200
- * new value. Either way the current/old limit is returned.
201
- *
202
- * @overload limit_resource(resource)
203
- * Get resource limits.
204
- * @param resource [String, Symbol] the type of resource
199
+ * Convert the name of a resource to its ResourceType.
205
200
  *
206
- * @overload limit_resource(resource, limit)
207
- * Set resource limits.
208
- * @param resource [String, Symbol] the type of resource
209
- * @param limit [Numeric] the new limit number
201
+ * No Ruby usage (internal function)
210
202
  *
211
- * @return [Numeric] the old limit.
203
+ * @param resource the name of the resource, a String or Symbol
204
+ * @return the resource type, or UndefinedResource for nil or an empty string
212
205
  */
213
- VALUE
214
- Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
206
+ static ResourceType
207
+ resource_type(VALUE resource)
215
208
  {
216
- VALUE resource, limit;
217
209
  ResourceType res = UndefinedResource;
218
210
  char *str;
219
211
  ID id;
220
- MagickSizeType cur_limit;
221
-
222
- rb_scan_args(argc, argv, "11", &resource, &limit);
223
212
 
224
213
  switch (TYPE(resource))
225
214
  {
226
215
  case T_NIL:
227
- return klass;
216
+ break;
228
217
 
229
218
  case T_SYMBOL:
230
219
  id = (ID)SYM2ID(resource);
@@ -262,7 +251,7 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
262
251
  str = StringValueCStr(resource);
263
252
  if (*str == '\0')
264
253
  {
265
- return klass;
254
+ break;
266
255
  }
267
256
  else if (rm_strcasecmp("area", str) == 0)
268
257
  {
@@ -297,6 +286,40 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
297
286
 
298
287
  RB_GC_GUARD(resource);
299
288
 
289
+ return res;
290
+ }
291
+
292
+
293
+ /**
294
+ * Get/set resource limits. If a limit is specified the old limit is set to the
295
+ * new value. Either way the current/old limit is returned.
296
+ *
297
+ * @overload limit_resource(resource)
298
+ * Get resource limits.
299
+ * @param resource [String, Symbol] the type of resource
300
+ *
301
+ * @overload limit_resource(resource, limit)
302
+ * Set resource limits.
303
+ * @param resource [String, Symbol] the type of resource
304
+ * @param limit [Numeric] the new limit number
305
+ *
306
+ * @return [Numeric] the old limit.
307
+ */
308
+ VALUE
309
+ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
310
+ {
311
+ VALUE resource, limit;
312
+ ResourceType res;
313
+ MagickSizeType cur_limit;
314
+
315
+ rb_scan_args(argc, argv, "11", &resource, &limit);
316
+
317
+ res = resource_type(resource);
318
+ if (res == UndefinedResource)
319
+ {
320
+ return klass;
321
+ }
322
+
300
323
  cur_limit = GetMagickResourceLimit(res);
301
324
 
302
325
  if (argc > 1)
@@ -310,6 +333,37 @@ Magick_limit_resource(int argc, VALUE *argv, VALUE klass)
310
333
  }
311
334
 
312
335
 
336
+ /**
337
+ * Get the amount of a resource that ImageMagick is using now. The memory, map
338
+ * and disk resources are in bytes. Most of them are the pixel caches of all
339
+ * images, including those of Image objects that are no longer referenced but
340
+ * have not been garbage collected yet. ImageMagick also counts blobs that it
341
+ * maps into memory and a few internal buffers, but not other memory it
342
+ * allocates.
343
+ *
344
+ * The area resource is the number of pixels of the last pixel cache that was
345
+ * checked against its limit, not a total.
346
+ *
347
+ * @param resource [String, Symbol] the type of resource
348
+ * @return [Numeric] the amount in use
349
+ * @see limit_resource
350
+ * @example
351
+ * GC.start if Magick.resource_usage(:memory) > 1024**3
352
+ */
353
+ VALUE
354
+ Magick_resource_usage(VALUE klass ATTRIBUTE_UNUSED, VALUE resource)
355
+ {
356
+ ResourceType res = resource_type(resource);
357
+
358
+ if (res == UndefinedResource)
359
+ {
360
+ rb_raise(rb_eArgError, "no resource given");
361
+ }
362
+
363
+ return ULL2NUM(GetMagickResource(res));
364
+ }
365
+
366
+
313
367
  /**
314
368
  * Set the amount of free memory allocated for the pixel cache. Once this
315
369
  * threshold is exceeded, all subsequent pixel cache operations are to/from
@@ -555,6 +555,7 @@ extern VALUE Magick_colors(VALUE);
555
555
  extern VALUE Magick_fonts(VALUE);
556
556
  extern VALUE Magick_init_formats(VALUE);
557
557
  extern VALUE Magick_limit_resource(int, VALUE *, VALUE);
558
+ extern VALUE Magick_resource_usage(VALUE, VALUE);
558
559
  extern VALUE Magick_set_cache_threshold(VALUE, VALUE);
559
560
  extern VALUE Magick_set_log_event_mask(int, VALUE *, VALUE);
560
561
  extern VALUE Magick_set_log_format(VALUE, VALUE);
@@ -587,10 +588,8 @@ ATTR_WRITER(Draw, tile)
587
588
  ATTR_WRITER(Draw, undercolor)
588
589
  extern VALUE Draw_alloc(VALUE);
589
590
  extern VALUE Draw_annotate(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
590
- extern VALUE Draw_clone(VALUE);
591
591
  extern VALUE Draw_composite(int, VALUE *, VALUE);
592
592
  extern VALUE Draw_draw(VALUE, VALUE);
593
- extern VALUE Draw_dup(VALUE);
594
593
  extern VALUE Draw_get_multiline_type_metrics(int, VALUE *, VALUE);
595
594
  extern VALUE Draw_get_type_metrics(int, VALUE *, VALUE);
596
595
  extern VALUE Draw_init_copy(VALUE, VALUE);
@@ -725,7 +724,7 @@ extern VALUE KernelInfo_initialize(VALUE, VALUE);
725
724
  extern VALUE KernelInfo_unity_add(VALUE, VALUE);
726
725
  extern VALUE KernelInfo_scale(VALUE, VALUE, VALUE);
727
726
  extern VALUE KernelInfo_scale_geometry(VALUE, VALUE);
728
- extern VALUE KernelInfo_clone(VALUE);
727
+ extern VALUE KernelInfo_init_copy(VALUE, VALUE);
729
728
 
730
729
  extern VALUE KernelInfo_builtin(VALUE, VALUE, VALUE);
731
730
 
@@ -840,7 +839,6 @@ extern VALUE Image_channel_mean(int, VALUE *, VALUE);
840
839
  extern VALUE Image_channel_entropy(int, VALUE *, VALUE);
841
840
  extern VALUE Image_charcoal(int, VALUE *, VALUE);
842
841
  extern VALUE Image_chop(VALUE, VALUE, VALUE, VALUE, VALUE);
843
- extern VALUE Image_clone(VALUE);
844
842
  extern VALUE Image_clut_channel(int, VALUE *, VALUE);
845
843
  extern VALUE Image_color_flood_fill(VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
846
844
  extern VALUE Image_color_histogram(VALUE);
@@ -882,7 +880,6 @@ extern VALUE Image_dissolve(int, VALUE *, VALUE);
882
880
  extern VALUE Image_distort(int, VALUE *, VALUE);
883
881
  extern VALUE Image_distortion_channel(int, VALUE *, VALUE);
884
882
  extern VALUE Image__dump(VALUE, VALUE);
885
- extern VALUE Image_dup(VALUE);
886
883
  extern VALUE Image_each_profile(VALUE);
887
884
  extern VALUE Image_edge(int, VALUE *, VALUE);
888
885
  extern VALUE Image_emboss(int, VALUE *, VALUE);
@@ -1053,8 +1050,6 @@ ATTR_ACCESSOR(Pixel, yellow)
1053
1050
  ATTR_ACCESSOR(Pixel, black)
1054
1051
  extern VALUE Pixel_alloc(VALUE);
1055
1052
  extern VALUE Pixel_case_eq(VALUE, VALUE);
1056
- extern VALUE Pixel_clone(VALUE);
1057
- extern VALUE Pixel_dup(VALUE);
1058
1053
  extern VALUE Pixel_eql_q(VALUE, VALUE);
1059
1054
  extern VALUE Pixel_fcmp(int, VALUE *, VALUE);
1060
1055
  extern VALUE Pixel_from_color(VALUE, VALUE);
@@ -1159,6 +1154,7 @@ extern VALUE rm_no_freeze(VALUE) ATTRIBUTE_NORETURN;
1159
1154
  extern int rm_strcasecmp(const char *, const char *);
1160
1155
  extern int rm_strncasecmp(const char *, const char *, size_t);
1161
1156
  extern size_t rm_strnlen_s(const char *, size_t);
1157
+ extern bool rm_has_file_reference(const char *);
1162
1158
  extern void rm_check_ary_len(VALUE, long);
1163
1159
  extern VALUE rm_check_ary_type(VALUE ary);
1164
1160
  extern Image *rm_check_destroyed(VALUE);
@@ -1010,26 +1010,6 @@ VALUE Draw_annotate(
1010
1010
  }
1011
1011
 
1012
1012
 
1013
- /**
1014
- * Clones this object.
1015
- *
1016
- * @return [Magick::Draw] the cloned object
1017
- */
1018
- VALUE
1019
- Draw_clone(VALUE self)
1020
- {
1021
- VALUE clone;
1022
-
1023
- clone = Draw_dup(self);
1024
- if (OBJ_FROZEN(self))
1025
- {
1026
- OBJ_FREEZE(clone);
1027
- }
1028
-
1029
- RB_GC_GUARD(clone);
1030
-
1031
- return clone;
1032
- }
1033
1013
 
1034
1014
 
1035
1015
  /**
@@ -1172,26 +1152,6 @@ Draw_draw(VALUE self, VALUE image_arg)
1172
1152
  }
1173
1153
 
1174
1154
 
1175
- /**
1176
- * Duplicate a Draw object.
1177
- *
1178
- * - Constructs a new Draw object, then calls initialize_copy.
1179
- *
1180
- * @return [Magick::Draw] the duplicated object
1181
- */
1182
- VALUE
1183
- Draw_dup(VALUE self)
1184
- {
1185
- Draw *draw;
1186
- VALUE dup;
1187
-
1188
- draw = ALLOC(Draw);
1189
- memset(draw, 0, sizeof(Draw));
1190
- dup = TypedData_Wrap_Struct(CLASS_OF(self), &rm_draw_data_type, draw);
1191
- RB_GC_GUARD(dup);
1192
-
1193
- return rb_funcall(dup, rm_ID_initialize_copy, 1, self);
1194
- }
1195
1155
 
1196
1156
 
1197
1157
  /**