projects/guix·blob java-team · refs

40 lines · 1.4 KiB

1Index: renpy-8.5.0-source/renpy/cslots.pyx
2===================================================================
3--- renpy-8.5.0-source.orig/renpy/cslots.pyx
4+++ renpy-8.5.0-source/renpy/cslots.pyx
5@@ -32,6 +32,9 @@ Value unions, followed by a series of by
6 from cpython.mem cimport PyMem_Calloc, PyMem_Free
7 from cpython.object cimport PyObject, PyTypeObject, Py_TPFLAGS_HAVE_GC, PyObject_Free
8 from cpython.ref cimport Py_XINCREF, Py_XDECREF, Py_CLEAR
9+cdef extern from "<limits.h>":
10+ const long long LLONG_MIN
11+ const long long LLONG_MAX
12
13 from copyreg import __newobj__
14
15@@ -51,7 +54,7 @@ cdef unsigned char DEFAULT_VALUE = 0xff
16
17 cdef union Value:
18 PyObject *object
19- unsigned long long integer
20+ long long integer
21
22 cdef class CMetaclass(type):
23
24@@ -369,10 +372,15 @@ cdef class IntegerSlot(Slot):
25 super(IntegerSlot, self).__init__(default_value)
26 self.default_int_value = default_value
27
28- def __set__(self, CObject instance, unsigned int value):
29+ def __set__(self, CObject instance, long long value):
30
31 cdef Value v
32
33+ if value >= (LLONG_MAX >> 1):
34+ raise OverflowError("Value is too large for an IntegerSlot")
35+ if value <= (LLONG_MIN >> 1):
36+ raise OverflowError("Value is too small for an IntegerSlot")
37+
38 if value == self.default_int_value:
39 v.object = NULL
40 else: