#pragma pack(1)
prevents aligning the struct and its members to their required alignment. This can result in code that performs non-aligned reads and writes to integers and pointers, which is problematic on some architectures.
It also triggers UBsan — see #17156 (comment) and #17510.
So remove the pragmas.