Limit HEIF output dimensions to 16384x16384

This is a slightly breaking change to sync with the behaviour of a
forthcoming libvips patch release. It also matches the libavif
limit. Having an arbitrary limit is safer than no limit.
This commit is contained in:
Lovell Fuller
2023-07-10 10:24:12 +01:00
parent d2f0fa855b
commit 5522060e9e
4 changed files with 22 additions and 0 deletions

View File

@@ -130,4 +130,18 @@ describe('AVIF', () => {
width: 32
});
});
it('Invalid width - too large', async () =>
assert.rejects(
() => sharp({ create: { width: 16385, height: 16, channels: 3, background: 'red' } }).avif().toBuffer(),
/Processed image is too large for the HEIF format/
)
);
it('Invalid height - too large', async () =>
assert.rejects(
() => sharp({ create: { width: 16, height: 16385, channels: 3, background: 'red' } }).avif().toBuffer(),
/Processed image is too large for the HEIF format/
)
);
});