Skip to content

Commit bf72dc8

Browse files
authored
Fix OOB in UniformScaling ctor. (#442)
1 parent 58736e4 commit bf72dc8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/host/construction.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ end
2424

2525
function identity_kernel(ctx::AbstractKernelContext, res::AbstractArray{T}, stride, val) where T
2626
i = linear_index(ctx)
27-
i > stride && return
2827
ilin = (stride * (i - 1)) + i
28+
ilin > length(res) && return
2929
@inbounds res[ilin] = val
3030
return
3131
end

test/testsuite/construction.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,5 +178,11 @@
178178
@test eltype(x1) == T
179179
@test Array(x1) x
180180
end
181+
182+
@testset "JuliaGPU/GPUArrays.jl#439" begin
183+
x = AT{Float32}(I, 500, 300)
184+
y = Array{Float32}(I, 500, 300)
185+
@test Array(x) == y
186+
end
181187
end
182188
end

0 commit comments

Comments
 (0)