Soften limitInputPixels upper limit #146

Default limit of 14-bit dimensions remains
This commit is contained in:
Lovell Fuller 2015-04-12 14:23:36 +01:00
parent ccb7887cb9
commit ae968142ee
2 changed files with 1 additions and 11 deletions

View File

@ -442,7 +442,7 @@ Sharp.prototype.resize = function(width, height) {
Assumes the image dimensions contained in the file header can be trusted Assumes the image dimensions contained in the file header can be trusted
*/ */
Sharp.prototype.limitInputPixels = function(limit) { 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; this.options.limitInputPixels = limit;
} else { } else {
throw new Error('Invalid pixel limit (1 to ' + maximum.pixels + ') ' + limit); throw new Error('Invalid pixel limit (1 to ' + maximum.pixels + ') ' + limit);

View File

@ -665,16 +665,6 @@ describe('Input/output', function() {
done(); 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) { it('Invalid fails - string', function(done) {
var isValid = false; var isValid = false;
try { try {