Skip to content

Commit

Permalink
fix: Don't align ALI block size to 4 byte boundary
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pastelmind committed Jul 11, 2022
1 parent 70ffd71 commit f4fc949
Showing 1 changed file with 0 additions and 4 deletions.
Expand Up @@ -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;
}

Expand Down

0 comments on commit f4fc949

Please sign in to comment.