mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 02:30:12 +02:00
Soften limitInputPixels upper limit #146
Default limit of 14-bit dimensions remains
This commit is contained in:
parent
ccb7887cb9
commit
ae968142ee
2
index.js
2
index.js
@ -442,7 +442,7 @@ Sharp.prototype.resize = function(width, height) {
|
||||
Assumes the image dimensions contained in the file header can be trusted
|
||||
*/
|
||||
Sharp.prototype.limitInputPixels = function(limit) {
|
||||
if (typeof limit === 'number' && !Number.isNaN(limit) && limit % 1 === 0 && limit > 0 && limit <= maximum.pixels) {
|
||||
if (typeof limit === 'number' && !Number.isNaN(limit) && limit % 1 === 0 && limit > 0) {
|
||||
this.options.limitInputPixels = limit;
|
||||
} else {
|
||||
throw new Error('Invalid pixel limit (1 to ' + maximum.pixels + ') ' + limit);
|
||||
|
@ -665,16 +665,6 @@ describe('Input/output', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
it('Invalid fails - huge', function(done) {
|
||||
var isValid = false;
|
||||
try {
|
||||
sharp().limitInputPixels(Math.pow(0x3FFF, 2) + 1);
|
||||
isValid = true;
|
||||
} catch (e) {}
|
||||
assert(!isValid);
|
||||
done();
|
||||
});
|
||||
|
||||
it('Invalid fails - string', function(done) {
|
||||
var isValid = false;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user