From c78cd5c43eff44228461be92f2bdc7d85cc66193 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0tampar?= Date: Sun, 19 Jul 2026 13:54:19 +0200 Subject: [PATCH] Fixes potential collisions in list/tuple with cachedmethod --- lib/core/decorators.py | 9 +++++++-- lib/core/settings.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/core/decorators.py b/lib/core/decorators.py index 049069267..aa6c1a850 100644 --- a/lib/core/decorators.py +++ b/lib/core/decorators.py @@ -15,6 +15,11 @@ from lib.core.threads import getCurrentThreadData _cache = {} _method_locks = {} +# Private marker prefixing the slow-path (frozen) cache key so it can never collide with a raw +# fast-path key: without it e.g. args ([1,2],) freezes to ((1,2),), the exact fast key of ((1,2),), +# and the two calls would share a cache slot and return each other's result +_FROZEN_KEY_MARKER = object() + def cachedmethod(f): """ Method with a cached content @@ -62,9 +67,9 @@ def cachedmethod(f): # Note: fallback (slow-path) for unhashable arguments try: if kwargs: - key = (_freeze(args), _freeze(kwargs)) + key = (_FROZEN_KEY_MARKER, _freeze(args), _freeze(kwargs)) else: - key = _freeze(args) + key = (_FROZEN_KEY_MARKER, _freeze(args)) with lock: if key in cache: diff --git a/lib/core/settings.py b/lib/core/settings.py index d261bb3e7..7a33b3f1f 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.7.127" +VERSION = "1.10.7.128" 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)