RE: Protect some DIB functions from bad inputs.