realloc seems to assume memory corruption if the new size is too large(?)

also, add another assert and a document where it doesn't hold