Yes, max(0, -1) is 0. I'm not quite sure bdr.qname.length() could be so big to cause overflow in integers.