Boyan-MILANOV / ropium

ROPium is a tool that helps you building ROP exploits by finding and chaining gadgets together
382 stars 41 forks source link

Crash: PY_SSIZE_T_CLEAN macro must be defined for '#' formats #41

Open mechgt opened 1 year ago

mechgt commented 1 year ago

There seems to be a breaking change in python 3.10 (see https://docs.python.org/3.10/whatsnew/3.10.html#id2 ) where PY_SSIZE_T_CLEAN needs to be defined. See error below I receive when attempting to run ropium,

(ropium)> load -a X86 myfile.dll

Traceback (most recent call last):
  File "/usr/bin/ropium", line 524, in <module>
    main()
  File "/usr/bin/ropium", line 84, in main
    load(args[1:])
  File "/usr/bin/ropium", line 205, in load
    compiler.load(f)
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats
mechgt commented 1 year ago

I believe that PY_SSIZE_T_CLEAN needs to be defined, and a few types need to be changed from int to Py_ssize_t. I don't exactly understand all of this, but managed to get it working anyway and sent a pull request.

Change details in case others are interested: https://github.com/mechgt/ropium/commit/212ed51438151c609b86d692e6e863c2c44f3781