python3-pyside6/0001-signature-Fix-pointers-to-signature-bytes-with-the-h.patch
Christophe Marin 2b90227d1d Added a changelog that is required in order to submit this to SLFO
(I wrote the changelog looking at a diff between 6.8.0 and 6.8.0.2)

  - Support lazy nested types.
  - Provide __all__ only on demand.
  - Handle correctly callback dynamic slots that fail.
  - Small fixes.

OBS-URL: https://build.opensuse.org/package/show/KDE:Qt6/python3-pyside6?expand=0&rev=90
2024-11-14 08:10:32 +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