PDF: prevent buffer underflow better