You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to #56, if the dunder method is cursed into ctypes' integer types, a raised exception causes Python to crash on Windows.
Proof of concept:
#!/usr/bin/env python3fromctypesimportc_intfromforbiddenfruitimportcursedefc_int_add(self: c_int, other: int) ->c_int:
raiseTypeError('This exception should be caught')
curse(c_int, '__add__', c_int_add)
try:
print(c_int(1) +1) # TypeError (correct) then crash on Windows (wrong)exceptTypeError:
print('TypeError caught')
print('If this gets printed then nothing has crashed')
Test result on Windows (version 10.0.19043.1052, Python 3.8.6, both 64-bit):
(venv) C:\dev\test> python bug2.py
Exception ignored on calling ctypes callback function: <function c_int_add at 0x000001E12AC1FDC0>
Traceback (most recent call last):
File "E:\src\pytrickz\venv\lib\site-packages\forbiddenfruit\__init__.py", line 328, in wrapper
return func(*args, **kwargs)
File "bug2.py", line 7, in c_int_add
raise TypeError('This exception should be caught')
TypeError: This exception should be caught
(venv) C:\dev\test> echo %=ExitCode%
C0000005
(venv) C:\dev\test>
The text was updated successfully, but these errors were encountered:
In addition to #56, if the dunder method is cursed into
ctypes
' integer types, a raised exception causes Python to crash on Windows.Proof of concept:
Test result on Windows (version 10.0.19043.1052, Python 3.8.6, both 64-bit):
The text was updated successfully, but these errors were encountered: