Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/cutorch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumith Chintala <soumith@gmail.com>2016-05-01 03:10:15 +0300
committerSoumith Chintala <soumith@gmail.com>2016-05-01 03:10:15 +0300
commit0fe1a4c702b78c2b2f8b82f9000a3d021ad0d0a5 (patch)
tree4870a226f08f0384adc189f0a65db399e31206ee
parentc3c8f15ef9b771bbef59cee1bda883727f865c4e (diff)
parenteb60e79bb10f0c6d3dfb7232c09d7b231f0566bd (diff)
Merge pull request #399 from htwaijry/master
Fix unchecked memory access when indexing a CudaTensor
-rw-r--r--lib/THC/THCTensorIndex.cu2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/THC/THCTensorIndex.cu b/lib/THC/THCTensorIndex.cu
index dbfe2a9..a23daa9 100644
--- a/lib/THC/THCTensorIndex.cu
+++ b/lib/THC/THCTensorIndex.cu
@@ -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);