Files
odfstudio/external/python3/ubsan.patch.0
T
Stephan Bergmann 28cd273a75 Reapply external/python3/ubsan.patch.0 hunk
...that 241826dcb9 "python3: upgrade to 3.13.11
(master only)" had simply dropped, but which is still necessary to silence
pointer-overflow issues as discussed in the commit message of
fcaef01faf "external/python3: Silence
pointer-overflow" (now, it caused e.g.

> [FIO] fcfg_database_others.xcu
> Parser/lexer/buffer.c:30:41: runtime error: pointer index expression with base 0x7d8e21edb920 overflowed to 0xfffffffffffe2000
>  #0 in _PyLexer_restore_fstring_buffers at workdir/UnpackedTarball/python3/Parser/lexer/buffer.c:30:41
>  #1 in _PyLexer_tok_reserve_buf at workdir/UnpackedTarball/python3/Parser/lexer/buffer.c:73:9
>  #2 in tok_readline_raw at workdir/UnpackedTarball/python3/Parser/tokenizer/file_tokenizer.c:59:14
[...]

to fail during the build)

Change-Id: Ib91feb446f6dfcbe3e60b8e3b54ac6503546ddda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195773
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2025-12-17 15:01:57 +01:00

48 lines
1.8 KiB
Plaintext

--- Modules/posixmodule.c
+++ Modules/posixmodule.c
@@ -13998,6 +13998,9 @@
};
static int
+#if defined __clang__
+__attribute__((no_sanitize("shift-base"))) // MFD_HUGE_16GB in /usr/include/linux/memfd.h
+#endif
all_ins(PyObject *m)
{
#ifdef F_OK
--- Objects/dictobject.c
+++ Objects/dictobject.c
@@ -2105,7 +2105,7 @@
if (unicode) { // combined unicode -> combined unicode
PyDictUnicodeEntry *newentries = DK_UNICODE_ENTRIES(newkeys);
if (oldkeys->dk_nentries == numentries && mp->ma_keys->dk_kind == DICT_KEYS_UNICODE) {
- memcpy(newentries, oldentries, numentries * sizeof(PyDictUnicodeEntry));
+ memcpy(newentries, (void *) oldentries, numentries * sizeof(PyDictUnicodeEntry));
}
else {
PyDictUnicodeEntry *ep = oldentries;
--- Objects/listobject.c
+++ Objects/listobject.c
@@ -539,7 +539,7 @@
dest[i] = Py_NewRef(v);
}
src = b->ob_item;
- dest = np->ob_item + Py_SIZE(a);
+ dest = Py_SIZE(a) == 0 ? np->ob_item : np->ob_item + Py_SIZE(a);
for (i = 0; i < Py_SIZE(b); i++) {
PyObject *v = src[i];
dest[i] = Py_NewRef(v);
--- Parser/lexer/buffer.c
+++ Parser/lexer/buffer.c
@@ -27,8 +27,8 @@
for (index = tok->tok_mode_stack_index; index >= 0; --index) {
mode = &(tok->tok_mode_stack[index]);
- mode->f_string_start = tok->buf + mode->f_string_start_offset;
- mode->f_string_multi_line_start = tok->buf + mode->f_string_multi_line_start_offset;
+ mode->f_string_start = (char *) (((intptr_t) tok->buf) + mode->f_string_start_offset);
+ mode->f_string_multi_line_start = (char *) (((intptr_t) tok->buf) + mode->f_string_multi_line_start_offset);
}
}