Skip to content

Commit

Permalink
Merge pull request torch#399 from htwaijry/master
Browse files Browse the repository at this point in the history
Fix unchecked memory access when indexing a CudaTensor
  • Loading branch information
soumith committed May 1, 2016
2 parents c3c8f15 + eb60e79 commit 0fe1a4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/THC/THCTensorIndex.cu
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,8 @@ void THCudaTensor_indexSelect_long(THCState *state, THCudaTensor *dst, THCudaTen
{
THAssert(THCudaTensor_checkGPU(state, 2, dst, src));

THArgCheck(indices->nDimension == 1, 3, "Index is supposed to be a vector");

THCudaTensor *indices_ = THCudaTensor_newWithSize1d(state, indices->size[0]);
THCudaTensor_copyLong(state, indices_, indices);

Expand Down

0 comments on commit 0fe1a4c

Please sign in to comment.