packfile.c: prevent overflow in `nth_packed_object_id()`