Merge pull request #3845 from mbyt/out_of_memory_access_as_strided

BUG: ensure integer shape, strides for as_strided