Skip to content

Commit 099d07f

Browse files
nsajkoKristofferC
authored andcommitted
fix rawbigints OOB issues (#55917)
Fixes issues introduced in #50691 and found in #55906: * use `@inbounds` and `@boundscheck` macros in rawbigints, for catching OOB with `--check-bounds=yes` * fix OOB in `truncate` (cherry picked from commit 17445fe)
1 parent 501a4f2 commit 099d07f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/mpfr.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,3 +1055,12 @@ end
10551055
end
10561056
end
10571057
end
1058+
1059+
@testset "RawBigInt truncation OOB read" begin
1060+
@testset "T: $T" for T (UInt8, UInt16, UInt32, UInt64, UInt128)
1061+
v = Base.RawBigInt{T}("a"^sizeof(T), 1)
1062+
@testset "bit_count: $bit_count" for bit_count (0:10:80)
1063+
@test Base.truncated(UInt128, v, bit_count) isa Any
1064+
end
1065+
end
1066+
end

0 commit comments

Comments
 (0)