external/python3/ubsan.patch.0 |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit e87fdbb86d504d44c2417702d2edd77319a1b42c
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Thu Jan 9 21:33:41 2025 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Fri Jan 10 08:05:41 2025 +0100

    external/python3: Avoid misaligned-pointer-use
    
    ...when generating Python/deepfreeze/deepfreeze.c during the build of
    ExternalProject_python3 after 50524481b30d904ee4a12ef478eeae05647a465d 
"Python:
    upgrade to 3.11.11 (master only)",
    
    > Objects/dictobject.c:1500:40: runtime error: load of misaligned address 
0x555853494d81 for type 'PyDictUnicodeEntry *', which requires 8 byte alignment
    > 0x555853494d81: note: pointer points here
    >  00 00 00  ff ff ff ff ff ff ff ff  00 00 00 00 00 00 00 00  00 00 00 00 
00 00 00 00  00 00 00 00 00
    >               ^
    >  #0 in dictresize at 
workdir/UnpackedTarball/python3/Objects/dictobject.c:1500:21
    >  #1 in dict_merge at 
workdir/UnpackedTarball/python3/Objects/dictobject.c:2880:17
    >  #2 in _PyDict_MergeEx at 
workdir/UnpackedTarball/python3/Objects/dictobject.c:3003:12
    >  #3 in _PyEval_EvalFrameDefault at 
workdir/UnpackedTarball/python3/Python/ceval.c:3432:17
    >  #4 in _PyEval_EvalFrame at 
workdir/UnpackedTarball/python3/./Include/internal/pycore_ceval.h:73:16
    >  #5 in _PyEval_Vector at 
workdir/UnpackedTarball/python3/Python/ceval.c:6434:24
    >  #6 in _PyFunction_Vectorcall at 
workdir/UnpackedTarball/python3/Objects/call.c:393:16
    >  #7 in _PyObject_FastCallDictTstate at 
workdir/UnpackedTarball/python3/Objects/call.c:141:15
    >  #8 in _PyObject_Call_Prepend at 
workdir/UnpackedTarball/python3/Objects/call.c:482:24
    >  #9 in slot_tp_init at 
workdir/UnpackedTarball/python3/Objects/typeobject.c:7855:15
    >  #10 in type_call at 
workdir/UnpackedTarball/python3/Objects/typeobject.c:1103:19
    >  #11 in _PyObject_MakeTpCall at 
workdir/UnpackedTarball/python3/Objects/call.c:214:18
    >  #12 in _PyObject_VectorcallTstate at 
workdir/UnpackedTarball/python3/./Include/internal/pycore_call.h:90:16
    >  #13 in PyObject_Vectorcall at 
workdir/UnpackedTarball/python3/Objects/call.c:299:12
    >  #14 in _PyEval_EvalFrameDefault at 
workdir/UnpackedTarball/python3/Python/ceval.c:4769:23
    >  #15 in _PyEval_EvalFrame at 
workdir/UnpackedTarball/python3/./Include/internal/pycore_ceval.h:73:16
    >  #16 in _PyEval_Vector at 
workdir/UnpackedTarball/python3/Python/ceval.c:6434:24
    >  #17 in PyEval_EvalCode at 
workdir/UnpackedTarball/python3/Python/ceval.c:1148:21
    >  #18 in run_eval_code_obj at 
workdir/UnpackedTarball/python3/Python/pythonrun.c:1741:9
    >  #19 in run_mod at 
workdir/UnpackedTarball/python3/Python/pythonrun.c:1762:19
    >  #20 in pyrun_file at 
workdir/UnpackedTarball/python3/Python/pythonrun.c:1657:15
    >  #21 in _PyRun_SimpleFileObject at 
workdir/UnpackedTarball/python3/Python/pythonrun.c:440:13
    >  #22 in _PyRun_AnyFileObject at 
workdir/UnpackedTarball/python3/Python/pythonrun.c:79:15
    >  #23 in pymain_run_file_obj at 
workdir/UnpackedTarball/python3/Modules/main.c:360:15
    >  #24 in pymain_run_file at 
workdir/UnpackedTarball/python3/Modules/main.c:379:15
    >  #25 in pymain_run_python at 
workdir/UnpackedTarball/python3/Modules/main.c:605:21
    >  #26 in Py_RunMain at workdir/UnpackedTarball/python3/Modules/main.c:684:5
    >  #27 in main at 
workdir/UnpackedTarball/python3/Programs/_bootstrap_python.c:109:12
    
    Change-Id: I0bacef11b5874bca6104516a206076a0505528ed
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180037
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/external/python3/ubsan.patch.0 b/external/python3/ubsan.patch.0
index d44fbe055c86..d9e9d4423214 100644
--- a/external/python3/ubsan.patch.0
+++ b/external/python3/ubsan.patch.0
@@ -30,6 +30,17 @@
  all_ins(PyObject *m)
  {
  #ifdef F_OK
+--- Objects/dictobject.c
++++ Objects/dictobject.c
+@@ -1497,7 +1497,7 @@
+             if (unicode) { // combined unicode -> combined unicode
+                 PyDictUnicodeEntry *newentries = 
DK_UNICODE_ENTRIES(mp->ma_keys);
+                 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
 @@ -554,7 +554,7 @@

Reply via email to