https://github.com/JuliaLang/julia
Revision e2cfc6f80b62a1b655f543d280ac5f8ca2b7ba95 authored by Rafael Fourquet on 16 June 2020, 17:47:24 UTC, committed by Kristoffer on 16 June 2020, 17:49:04 UTC
* deleteat! : check bounds for the first passed index

All other indices are bound-checked.
Currently, the behavior looks like:
```julia
julia> deleteat!([1:1000;], [-100])

signal (11): Segmentation fault
[...]

julia>  deleteat!(BigInt[0], [0])
free(): invalid next size (normal)

signal (6): Aborted
[...]

julia> deleteat!(BigInt[0], [-100])
ERROR: UndefRefError: access to undefined reference
[...]

julia> deleteat!([0], [0])
Int64[]

julia> deleteat!([0], [2])
1-element Array{Int64,1}:
 0

julia> deleteat!([0], [3])
ERROR: InexactError: check_top_bit(UInt64, -1)
[...]
```
With this commit, all these expressions throw a `BoundsError`.

* Update base/array.jl

Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>

Co-authored-by: Simeon Schaub <simeondavidschaub99@gmail.com>
(cherry picked from commit 6cdfcf9b48c0c4d4cd4022539ec7e5083df9e8e3)
1 parent 1cf4720
History
Tip revision: e2cfc6f80b62a1b655f543d280ac5f8ca2b7ba95 authored by Rafael Fourquet on 16 June 2020, 17:47:24 UTC
deleteat! : check bounds for the first passed index (#36231)
Tip revision: e2cfc6f
File Mode Size
.devcontainer
base
contrib
deps
doc
etc
src
stdlib
test
ui
.appveyor.yml -rw-r--r-- 2.1 KB
.gitattributes -rw-r--r-- 65 bytes
.gitignore -rw-r--r-- 273 bytes
.mailmap -rw-r--r-- 11.0 KB
.travis.yml -rw-r--r-- 6.1 KB
CITATION.bib -rw-r--r-- 2.6 KB
CONTRIBUTING.md -rw-r--r-- 19.9 KB
HISTORY.md -rw-r--r-- 275.6 KB
LICENSE.md -rw-r--r-- 5.0 KB
Make.inc -rw-r--r-- 44.1 KB
Makefile -rw-r--r-- 26.9 KB
NEWS.md -rw-r--r-- 16.4 KB
README.md -rw-r--r-- 6.3 KB
VERSION -rw-r--r-- 10 bytes
sysimage.mk -rw-r--r-- 3.9 KB

README.md

back to top