mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Ensure correct pageHeight when verifying image dimensions (#2343)
This commit is contained in:
parent
866e9824d1
commit
00e65f6f14
@ -485,8 +485,8 @@ namespace sharp {
|
|||||||
Check the proposed format supports the current dimensions.
|
Check the proposed format supports the current dimensions.
|
||||||
*/
|
*/
|
||||||
void AssertImageTypeDimensions(VImage image, ImageType const imageType) {
|
void AssertImageTypeDimensions(VImage image, ImageType const imageType) {
|
||||||
const int height = image.get_typeof("pageHeight") == G_TYPE_INT
|
const int height = image.get_typeof(VIPS_META_PAGE_HEIGHT) == G_TYPE_INT
|
||||||
? image.get_int("pageHeight")
|
? image.get_int(VIPS_META_PAGE_HEIGHT)
|
||||||
: image.height();
|
: image.height();
|
||||||
if (imageType == ImageType::JPEG) {
|
if (imageType == ImageType::JPEG) {
|
||||||
if (image.width() > 65535 || height > 65535) {
|
if (image.width() > 65535 || height > 65535) {
|
||||||
|
BIN
test/fixtures/big-height.webp
vendored
Normal file
BIN
test/fixtures/big-height.webp
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
1
test/fixtures/index.js
vendored
1
test/fixtures/index.js
vendored
@ -95,6 +95,7 @@ module.exports = {
|
|||||||
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
||||||
inputWebPAnimated: getPath('rotating-squares.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
inputWebPAnimated: getPath('rotating-squares.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
||||||
inputWebPAnimatedLoop3: getPath('animated-loop-3.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
inputWebPAnimatedLoop3: getPath('animated-loop-3.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
||||||
|
inputWebPAnimatedBigHeight: getPath('big-height.webp'),
|
||||||
inputTiff: getPath('G31D.TIF'), // http://www.fileformat.info/format/tiff/sample/e6c9a6e5253348f4aef6d17b534360ab/index.htm
|
inputTiff: getPath('G31D.TIF'), // http://www.fileformat.info/format/tiff/sample/e6c9a6e5253348f4aef6d17b534360ab/index.htm
|
||||||
inputTiffMultipage: getPath('G31D_MULTI.TIF'), // gm convert G31D.TIF -resize 50% G31D_2.TIF ; tiffcp G31D.TIF G31D_2.TIF G31D_MULTI.TIF
|
inputTiffMultipage: getPath('G31D_MULTI.TIF'), // gm convert G31D.TIF -resize 50% G31D_2.TIF ; tiffcp G31D.TIF G31D_2.TIF G31D_MULTI.TIF
|
||||||
inputTiffCielab: getPath('cielab-dagams.tiff'), // https://github.com/lovell/sharp/issues/646
|
inputTiffCielab: getPath('cielab-dagams.tiff'), // https://github.com/lovell/sharp/issues/646
|
||||||
|
@ -16,4 +16,12 @@ describe('toBuffer', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('correctly process animated webp with height > 16383', (done) => {
|
||||||
|
const image = sharp(fixtures.inputWebPAnimatedBigHeight, { animated: true });
|
||||||
|
image.toBuffer().then((buff) => {
|
||||||
|
assert.strictEqual(Buffer.isBuffer(buff), true);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user