From f4fc9497d2826aeaed17910194dc9e8f7130ebe9 Mon Sep 17 00:00:00 2001 From: Ye-hyoung Kang Date: Sat, 9 Jul 2022 18:18:22 +0900 Subject: [PATCH] fix: Don't align ALI block size to 4 byte boundary ALI blocks are used in two locations inside a PSD file: - At the end of each Layer Info section. These ALI blocks describe properties of each layer. Although Adobe does not name these fields, I call them "Extra Info Blocks". - After the Global Layer Mask Info section. These are called "Tagged Blocks", and appear to describe properties of the entire PSD file. It is known that AdditionalLayerInfo (ALI) blocks are aligned to a multiple 4 bytes. (This is undocumented in Adobe's docs). However, we discovered that this only applies to Tagged Blocks, but not Extra Info Blocks. This caused some PSD files to fail to parse because we were wrongly enforcing the 4-byte alignment on Extra Info Blocks. Since our library only parses Extra Info Blocks (completely skipping Tagged Blocks), we can simply remove the 4-byte aligment code for now. This issue was reported by @immigration9 --- .../LayerAndMaskInformation/AdditionalLayerInfo/index.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/psd/src/sections/LayerAndMaskInformation/AdditionalLayerInfo/index.ts b/packages/psd/src/sections/LayerAndMaskInformation/AdditionalLayerInfo/index.ts index 032199b..4176924 100644 --- a/packages/psd/src/sections/LayerAndMaskInformation/AdditionalLayerInfo/index.ts +++ b/packages/psd/src/sections/LayerAndMaskInformation/AdditionalLayerInfo/index.ts @@ -40,10 +40,6 @@ export function readAdditionalLayerInfo( const remainingBytes = size - (cursor.position - prevPosition); cursor.pass(remainingBytes); - // AdditionalLayerInfo blocks are aligned to a multiple of 4 bytes - // (Undocumented in Adobe's docs) - cursor.padding(size, 4); - return aliBlock; }