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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unaligned write in convertsimple() #94149

Open
matoro opened this issue Jun 23, 2022 · 0 comments
Open

Unaligned write in convertsimple() #94149

matoro opened this issue Jun 23, 2022 · 0 comments
Labels
type-crash

Comments

@matoro
Copy link

@matoro matoro commented Jun 23, 2022

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.
@matoro matoro added the type-crash label Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-crash
Projects
None yet
Development

No branches or pull requests

1 participant