Turns out the pitch was accidentally used as width, leading to an out of bounds read/write. I kept the pitch in the struct for completeness' sake. It may be needed later, if only for error checks.