Use a very large id bound when fuzzing the optimizer, and check that the input does not ids that are too close to this bound. This should make it impossible in practice for an id overflow to occur. Fixes #4657.