Catch writes to protected memory in mmapped arrays (fix #3434)