PDF: prevent heap underflow