sharp 0.30.5 → 0.30.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.
package/lib/input.js CHANGED
@@ -86,10 +86,10 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
86
86
  inputDescriptor.limitInputPixels = inputOptions.limitInputPixels
87
87
  ? Math.pow(0x3FFF, 2)
88
88
  : 0;
89
- } else if (is.integer(inputOptions.limitInputPixels) && inputOptions.limitInputPixels >= 0) {
89
+ } else if (is.integer(inputOptions.limitInputPixels) && is.inRange(inputOptions.limitInputPixels, 0, Number.MAX_SAFE_INTEGER)) {
90
90
  inputDescriptor.limitInputPixels = inputOptions.limitInputPixels;
91
91
  } else {
92
- throw is.invalidParameterError('limitInputPixels', 'integer >= 0', inputOptions.limitInputPixels);
92
+ throw is.invalidParameterError('limitInputPixels', 'positive integer', inputOptions.limitInputPixels);
93
93
  }
94
94
  }
95
95
  // unlimited
package/lib/libvips.js CHANGED
@@ -68,6 +68,7 @@ const globalLibvipsVersion = function () {
68
68
  const globalLibvipsVersion = spawnSync('pkg-config --modversion vips-cpp', {
69
69
  ...spawnSyncOptions,
70
70
  env: {
71
+ ...env,
71
72
  PKG_CONFIG_PATH: pkgConfigPath()
72
73
  }
73
74
  }).stdout;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sharp",
3
3
  "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images",
4
- "version": "0.30.5",
4
+ "version": "0.30.6",
5
5
  "author": "Lovell Fuller <npm@lovell.info>",
6
6
  "homepage": "https://github.com/lovell/sharp",
7
7
  "contributors": [
package/src/common.cc CHANGED
@@ -48,6 +48,9 @@ namespace sharp {
48
48
  int32_t AttrAsInt32(Napi::Object obj, unsigned int const attr) {
49
49
  return obj.Get(attr).As<Napi::Number>().Int32Value();
50
50
  }
51
+ int64_t AttrAsInt64(Napi::Object obj, std::string attr) {
52
+ return obj.Get(attr).As<Napi::Number>().Int64Value();
53
+ }
51
54
  double AttrAsDouble(Napi::Object obj, std::string attr) {
52
55
  return obj.Get(attr).As<Napi::Number>().DoubleValue();
53
56
  }
@@ -131,7 +134,7 @@ namespace sharp {
131
134
  }
132
135
  }
133
136
  // Limit input images to a given number of pixels, where pixels = width * height
134
- descriptor->limitInputPixels = AttrAsUint32(input, "limitInputPixels");
137
+ descriptor->limitInputPixels = static_cast<uint64_t>(AttrAsInt64(input, "limitInputPixels"));
135
138
  // Allow switch from random to sequential access
136
139
  descriptor->access = AttrAsBool(input, "sequentialRead") ? VIPS_ACCESS_SEQUENTIAL : VIPS_ACCESS_RANDOM;
137
140
  // Remove safety features and allow unlimited SVG/PNG input
@@ -439,7 +442,7 @@ namespace sharp {
439
442
  }
440
443
  // Limit input images to a given number of pixels, where pixels = width * height
441
444
  if (descriptor->limitInputPixels > 0 &&
442
- static_cast<uint64_t>(image.width() * image.height()) > static_cast<uint64_t>(descriptor->limitInputPixels)) {
445
+ static_cast<uint64_t>(image.width() * image.height()) > descriptor->limitInputPixels) {
443
446
  throw vips::VError("Input image exceeds pixel limit");
444
447
  }
445
448
  return std::make_tuple(image, imageType);
package/src/common.h CHANGED
@@ -49,7 +49,7 @@ namespace sharp {
49
49
  std::string file;
50
50
  char *buffer;
51
51
  VipsFailOn failOn;
52
- int limitInputPixels;
52
+ uint64_t limitInputPixels;
53
53
  bool unlimited;
54
54
  VipsAccess access;
55
55
  size_t bufferLength;