Unaligned write in convertsimple()
While running the test suite for reportlab on sparc, an unaligned write is issued, which is fatal (SIGBUS) on the sparc architecture. I've submitted a fix in #94141, confirmed that it removes the crash and allows the entire reportlab test suite to pass, as well as passing the cpython test suite.
#0 0xfff80001007a98ac in convertsimple (arg=0x1000089a9d0, p_format=0x7feffb25bf8, p_va=0x7feffb260e0, flags=2, msgbuf=0x7feffb25e48 "", bufsize=256, freelist=0x7feffb25d38) at Python/getargs.c:921
921 *psize = count;
(gdb) l
916 if (count < 0)
917 return converterr(buf, arg, msgbuf, bufsize);
918 if (*format == '#') {
919 REQUIRE_PY_SSIZE_T_CLEAN;
920 Py_ssize_t *psize = va_arg(*p_va, Py_ssize_t*);
921 *psize = count;
922 format++;
923 } else {
924 if (strlen(*p) != (size_t)count) {
925 PyErr_SetString(PyExc_ValueError, "embedded null byte");
(gdb) ptype count
type = long
(gdb) p count
$1 = 14520
(gdb) ptype psize
type = long *
(gdb) p psize
$2 = (Py_ssize_t *) 0x7feffb261fc
(gdb) p 0x7feffb261fc % sizeof(long)
$3 = 4
Error messages
py-bt.txt - this is a Python traceback of the crash site generated by gdb's py-bt command.
bt-full.txt - traditional gdb backtrace.
Your environment
- CPython versions tested on: Observed issue on 3.10.5 and 3.9.12
- Operating system and architecture: Gentoo Linux 5.18.5 on 64-bit sparc.