translate: deal with size overflows by casting to ptrdiff_t