diff --git a/lib/core/settings.py b/lib/core/settings.py index 3beaa4cef..951488122 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (...) -VERSION = "1.10.9.11" +VERSION = "1.10.9.12" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/sqlmap.py b/sqlmap.py index 958550af8..d2eb8d96a 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -558,7 +558,7 @@ def main(): logger.critical(errMsg) raise SystemExit - elif (sys._jit.is_enabled() if hasattr(sys, "_jit") else os.environ.get("PYTHON_JIT") == '1'): + elif (sys._jit.is_enabled() if hasattr(sys, "_jit") else (sys.version_info >= (3, 13) and os.environ.get("PYTHON_JIT") == '1')): errMsg = "the experimental Python JIT compiler is turned on. CPython has an open defect where " errMsg += "the tier-2 optimizer runs the wrong instruction stream against a correct frame, raising " errMsg += "exceptions that the executed code cannot produce " diff --git a/tests/test_jit_guard.py b/tests/test_jit_guard.py index 394622caa..3a5fbde45 100644 --- a/tests/test_jit_guard.py +++ b/tests/test_jit_guard.py @@ -20,7 +20,10 @@ import unittest ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -# forces a crash inside init(), i.e. the same place #6117 landed, without needing a target. +# Forces a crash inside init(), i.e. the same place #6117 landed, without needing a target. +# NOTE: the injected fault must raise on Python 2 as well - 'a' < 128 does NOT (Python 2 orders +# mismatched types by type name and quietly returns a bool), which let a broken run reach the +# network on the PyPy-2.7 job instead of the exception handler under test. # codeIsModified() is neutralized because its branch sits earlier in the chain and would # otherwise win on any working tree with uncommitted edits (or a stale txt/checksum.md5). DRIVER = """ @@ -30,7 +33,7 @@ sys.argv = ["sqlmap.py", "-u", "http://127.0.0.1/?id=1", "--batch"] import sqlmap import lib.core.option sqlmap.codeIsModified = lambda: False -lib.core.option.loadPayloads = lambda: "a" < 128 +lib.core.option.loadPayloads = lambda: iter([])() sqlmap.main() """ % ROOT @@ -50,8 +53,9 @@ def _run(jit): def _jitEnabled(jit): - """Whether the interpreter actually honours PYTHON_JIT= (build-dependent).""" - code = "import sys, os; print(sys._jit.is_enabled() if hasattr(sys, '_jit') else os.environ.get('PYTHON_JIT') == '1')" + """Whether the guard in sqlmap.py would consider the JIT enabled (mirrors its condition).""" + code = ("import sys, os; print(sys._jit.is_enabled() if hasattr(sys, '_jit') " + "else (sys.version_info >= (3, 13) and os.environ.get('PYTHON_JIT') == '1'))") env = dict(os.environ) env["PYTHON_JIT"] = jit return subprocess.check_output([sys.executable, "-c", code], env=env).strip() == b"True"