And PSD is notoriously complicated. I remember reading some rant by an open source developer and there were things along the lines of different endianness in the same file.
It’s a 30+ year old format that went to multiple transitions. I don’t envy the poor soul that has to reverse engineer it.