New GitHub issue #119817 from Semnodime:<br>

<hr>

<pre>
# Crash report

### What happened?

```bash
# DEV=/dev/foo
# blockdev --getsize64 $DEV
1048576
# tail $DEV
# python3.12 bug.py
Bus error (core dumped)
# tail $DEV
hell#
```

```python
from mmap import mmap

with open('/dev/sda3', 'r+b') as file:
    m = mmap(file.fileno(), 1024 ** 2 + 1)

m.seek(1024 ** 2 - 4)

for b in b'hello world!':
 m.write(bytes([b]))
```

I hope you don't mind my reference to [Madagascar](https://www.imdb.com/title/tt0351283/fullcredits)


### CPython versions tested on:

3.12

### Operating systems tested on:

Linux

### Output from running 'python -VV' on the command line:

Python 3.12.3 (main, Apr 27 2024, 19:00:21) [GCC 11.4.0]
</pre>

<hr>

<a href="https://github.com/python/cpython/issues/119817">View on GitHub</a>
<p>Labels: type-crash</p>
<p>Assignee: </p>