Skip to content

Commit 05f81ab

Browse files
committed
Fixing the CI/CD failure
1 parent 788c9fa commit 05f81ab

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from thirdparty import six
2121

2222
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23-
VERSION = "1.10.7.33"
23+
VERSION = "1.10.7.34"
2424
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2525
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2626
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

lib/request/inject.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,10 @@ def _threadedInferenceValues(exprBuilder, indices, context=None, charsetType=Non
424424

425425
indices = list(indices)
426426

427-
savedTechnique = getTechnique()
427+
# Snapshot the raw per-thread technique (may be None) so the finally can restore it verbatim -
428+
# getTechnique() would fall back to kb.technique, and a None result there used to skip the restore
429+
# entirely, leaking the BOOLEAN/TIME we set below onto the calling thread for every later caller.
430+
savedTechnique = getCurrentThreadData().technique
428431

429432
if isTechniqueAvailable(PAYLOAD.TECHNIQUE.BOOLEAN):
430433
setTechnique(PAYLOAD.TECHNIQUE.BOOLEAN)
@@ -433,8 +436,12 @@ def _threadedInferenceValues(exprBuilder, indices, context=None, charsetType=Non
433436
else:
434437
return None
435438

436-
initTechnique(getTechnique())
437-
payload = agent.payload(newValue=agent.suffixQuery(agent.prefixQuery(getTechniqueData().vector)))
439+
try:
440+
initTechnique(getTechnique())
441+
payload = agent.payload(newValue=agent.suffixQuery(agent.prefixQuery(getTechniqueData().vector)))
442+
except:
443+
setTechnique(savedTechnique) # these run before the runThreads try/finally below, so restore here too
444+
raise
438445

439446
results = [None] * len(indices)
440447
cursor = iter(xrange(len(indices)))
@@ -501,8 +508,7 @@ def inferenceThread():
501508
kb.partRun = savedPartRun
502509
mainThreadData.disableStdOut = savedStdOut
503510
mainThreadData.shared = savedShared
504-
if savedTechnique is not None:
505-
setTechnique(savedTechnique)
511+
setTechnique(savedTechnique)
506512

507513
# Robustness: any slot a worker could not retrieve (None, i.e. a transient per-cell failure) is
508514
# re-extracted serially via the classic getValue() path - full error handling, and a persistent error

tests/test_databases_enum.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class _BaseEnumTest(unittest.TestCase):
6161

6262
# conf keys every test may read/write
6363
_CONF_KEYS = ("direct", "technique", "db", "tbl", "col", "exclude",
64-
"getComments", "excludeSysDbs", "search", "freshQueries")
64+
"getComments", "excludeSysDbs", "search", "freshQueries", "threads")
6565

6666
def setUp(self):
6767
self._saved_conf = {k: conf.get(k) for k in self._CONF_KEYS}
@@ -117,6 +117,7 @@ def _enable_inference(self):
117117
"""Take the blind inference branch: conf.direct off, a BOOLEAN technique present."""
118118
conf.direct = False
119119
conf.technique = None
120+
conf.threads = 1 # exercise the serial getValue() path these tests mock (>1 takes the value-parallel branch)
120121
kb.injection.data = {PAYLOAD.TECHNIQUE.BOOLEAN: {"title": "AND boolean-based blind"}}
121122

122123

@@ -533,7 +534,7 @@ def gv(query, *a, **k):
533534

534535
class _DbBase(unittest.TestCase):
535536
_CONF_KEYS = ("direct", "technique", "db", "tbl", "col", "exclude",
536-
"getComments", "excludeSysDbs", "search", "freshQueries")
537+
"getComments", "excludeSysDbs", "search", "freshQueries", "threads")
537538

538539
def setUp(self):
539540
self._saved_conf = {k: conf.get(k) for k in self._CONF_KEYS}
@@ -588,6 +589,7 @@ def _fresh(self):
588589
def _inference(self):
589590
conf.direct = False
590591
conf.technique = None
592+
conf.threads = 1 # exercise the serial getValue() path these tests mock (>1 takes the value-parallel branch)
591593
kb.injection.data = {PAYLOAD.TECHNIQUE.BOOLEAN: {"title": "AND boolean-based blind"}}
592594

593595

0 commit comments

Comments
 (0)