python3-pyside6/0001-signature-Fix-pointers-to-signature-bytes-with-the-h.patch
Christophe Marin 69cc0b1566 RFC, not fully built yet.
- Add patch to fix shiboken on 32bit platforms:
  * 0001-signature-Fix-pointers-to-signature-bytes-with-the-h.patch

OBS-URL: https://build.opensuse.org/package/show/KDE:Qt6/python3-pyside6?expand=0&rev=83
2024-10-14 13:15:41 +00:00

33 lines
1.4 KiB
Diff

From 7911d19e7cd8479c3b3098848ba1627e7de91f29 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Mon, 14 Oct 2024 13:09:41 +0200
Subject: [PATCH] signature: Fix pointers to signature bytes with the highest
bit set
If a pointer to signature bytes has the highest bit set (e.g. 0xf6dd2840 on
32bit), it is interpreted as negative Py_ssize_t value by Py_BuildValue.
PyLong_AsSize_t cannot convert this into size_t and returns -1, resulting
in an invalid pointer.
To avoid this, use PyLong_AsSsize_t and intptr_t instead.
---
sources/shiboken6/libshiboken/signature/signature.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sources/shiboken6/libshiboken/signature/signature.cpp b/sources/shiboken6/libshiboken/signature/signature.cpp
index e69de193f13b..09d4120bf002 100644
--- a/sources/shiboken6/libshiboken/signature/signature.cpp
+++ b/sources/shiboken6/libshiboken/signature/signature.cpp
@@ -435,7 +435,7 @@ PyObject *PySide_BuildSignatureProps(PyObject *type_key)
if (PyTuple_Check(numkey)) {
PyObject *obAddress = PyTuple_GetItem(numkey, 0);
PyObject *obSize = PyTuple_GetItem(numkey, 1);
- const size_t addr = PyLong_AsSize_t(obAddress);
+ const intptr_t addr = PyLong_AsSsize_t(obAddress);
const Py_ssize_t size = PyLong_AsSsize_t(obSize);
const char **cstrings = bytesToStrings(reinterpret_cast<const uint8_t *>(addr), size);
if (cstrings == nullptr)
--
2.47.0