Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 fix bus error on smaller readonly file in unix #44354

Merged
merged 10 commits into from
Aug 21, 2023
Next Next commit
馃悰 fix bus error on smaller readonly file in unix
  • Loading branch information
xgdgsc authored and vtjnash committed Jul 18, 2023
commit c9e56d48445c78cdfdfdd9296ad195275ee2178d
1 change: 1 addition & 0 deletions stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ function mmap(io::IO,
@static if Sys.isunix()
prot, flags, iswrite = settings(file_desc, shared)
iswrite && grow && grow!(io, offset, len)
!iswrite && mmaplen > filesize(io) && throw(ArgumentError("unable to mmap file size smaller than $mmaplen due to read-only permissions. Please check your dims"))
xgdgsc marked this conversation as resolved.
Show resolved Hide resolved
# mmap the file
ptr = ccall(:jl_mmap, Ptr{Cvoid}, (Ptr{Cvoid}, Csize_t, Cint, Cint, RawFD, Int64),
C_NULL, mmaplen, prot, flags, file_desc, offset_page)
Expand Down