local-fastimage_resize 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc2a36cc1fec1aa2da1551e83951ddbfa9c2a0d3
4
- data.tar.gz: 4a0fa8557d3a46e7531f4c7573c610e8e59ec8a4
3
+ metadata.gz: 50c371403135f3114a00aa4bc6c5f4b6dfb9b33c
4
+ data.tar.gz: a94a1d8ac982dfed7ac8f2c923f90361e105472c
5
5
  SHA512:
6
- metadata.gz: 1d7e47f691cd3db8f1bf305f3ffc63a73b8795f3680c83d862216e0b89ba82f6727a7a653f4504402dd349c9d10df0780ffe2d404fc5ac08f8251392056c0186
7
- data.tar.gz: e2c06d079a51c8f8d219da3df9de0de778470428a3155f5ff3918a54e2e5f55124944b1d84116c34745a1163413777273982b0bb24eeebfb0353427c6045e5c8
6
+ metadata.gz: 8f6caeb867b93b16d3ed126ca508cbc2ba020108f063ee8ce6dee6017e4b1dcc0a3f2e9224bd7f11e3c4647e0c1aa89ed22eb9d1c280e25ebe78a45ecb521331
7
+ data.tar.gz: 884d0de764ada380b77cd97841fc803eab00e52f9b3ad997f31cc20cc92fdf30737609bb8b94ed7adad16992ccf0091828e1b8f9730381cbb17bac9043c1f7d8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 3.2.0 - 2017-09-08
2
+
3
+ Check for some error cases in gd calls which might have resulted in null-pointer exceptions and subsequent segfaults.
4
+
5
+ If the resized image could not be created for any reason, we now raise a `FastImage::ImageFetchFailure` exception.
6
+
1
7
  # 3.1.1 - 2016-06-03
2
8
 
3
9
  Fix native code structure to work after gem install.
@@ -46,7 +46,11 @@ static VALUE fastimage_native_resize(VALUE self, VALUE rb_in, VALUE rb_out, VALU
46
46
  if (!f) trans = -1; /* no transparent pixel found */
47
47
  }
48
48
  break;
49
- default: return Qnil;
49
+ }
50
+
51
+ if (!im_in) {
52
+ fclose(in);
53
+ return Qnil;
50
54
  }
51
55
 
52
56
  if (w == 0 || h == 0) {
@@ -60,14 +64,17 @@ static VALUE fastimage_native_resize(VALUE self, VALUE rb_in, VALUE rb_out, VALU
60
64
  }
61
65
 
62
66
  im_out = gdImageCreateTrueColor(w, h); /* must be truecolor */
63
-
64
- if (image_type == 1) {
65
- gdImageAlphaBlending(im_out, 0); /* handle transparency correctly */
66
- gdImageSaveAlpha(im_out, 1);
67
+ if (im_out) {
68
+ if (image_type == 1) {
69
+ gdImageAlphaBlending(im_out, 0); /* handle transparency correctly */
70
+ gdImageSaveAlpha(im_out, 1);
71
+ }
72
+ fclose(in);
73
+ } else {
74
+ fclose(in);
75
+ return Qnil;
67
76
  }
68
77
 
69
- fclose(in);
70
-
71
78
  /* Now copy the original */
72
79
  gdImageCopyResampled(im_out, im_in, 0, 0, 0, 0,
73
80
  gdImageSX(im_out), gdImageSY(im_out),
@@ -77,9 +77,11 @@ module FastImage::Resize
77
77
 
78
78
  FastImage.native_resize(path, file_out.to_s, width.to_i, height.to_i, type_index, jpeg_quality.to_i)
79
79
 
80
+ raise FastImage::ImageFetchFailure, 'Image could be created' unless File.exist?(file_out.to_s)
81
+
80
82
  temp_file
81
83
  rescue RuntimeError => e
82
- raise ImageFetchFailure, e.message
84
+ raise FastImage::ImageFetchFailure, e.message
83
85
  end
84
86
  end
85
87
 
@@ -1,5 +1,5 @@
1
1
  class FastImage
2
2
  module Resize
3
- VERSION = "3.1.1"
3
+ VERSION = "3.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: local-fastimage_resize
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-03 00:00:00.000000000 Z
12
+ date: 2017-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: local-fastimage
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - libgd, see www.libgd.org
130
130
  rubyforge_project:
131
- rubygems_version: 2.4.8
131
+ rubygems_version: 2.6.13
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Local FastImage Resize - Image resizing fast and simple