mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-06-28 12:31:00 +00:00
Minor patch
This commit is contained in:
parent
a3fc171665
commit
0b2b3e956f
4 changed files with 69 additions and 4 deletions
|
|
@ -167,7 +167,7 @@ df768bcb9838dc6c46dab9b4a877056cb4742bd6cfaaf438c4a3712c5cc0d264 extra/shutils/
|
|||
d69e84f1648cdb907f5d2dd454f03874a4613752b07867510145d51d84b3c56f lib/controller/handler.py
|
||||
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/controller/__init__.py
|
||||
9da83429449d78797c18bb79ff425aa1eddf5b26b9987d25d042eb0998053675 lib/core/agent.py
|
||||
12d0f1f28796b6fbf5629a3fd335b4098eac0583f832d1aa650efa22bf52e782 lib/core/bigarray.py
|
||||
905e49d6e030a60f7767c71e0726e0def57c50542210afd9be1cdec122d2d1ce lib/core/bigarray.py
|
||||
dba8ebb5cfc6a085c6d91aff0135cfbe8716a40cc20cb1c7cfcd50b5a90e64f5 lib/core/common.py
|
||||
8f1272487e1adfcc8c755a2f56f0c6d21eac5e685a73a9a159482f9dc9142bc5 lib/core/compat.py
|
||||
742bce10b97034966021ec60c7ac294db4af4fe7893613d63172a02c29f009f8 lib/core/convert.py
|
||||
|
|
@ -189,7 +189,7 @@ ccc4a717e887652b1fcce073d9409d9c59a3b28548c703a9e453d15845f90cd7 lib/core/patch
|
|||
9bf174058f15d14e24e94f9aaf42df045119d3617c6c54bd2f3af79b462f331d lib/core/replication.py
|
||||
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
|
||||
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
|
||||
46468c8b40417c10bd9f472c259c89c0f0641bc247097006497118c3d7980672 lib/core/settings.py
|
||||
d1ad94ae601d7470f1e2fd77b834c048921043479939346b09c92d6a19cdda85 lib/core/settings.py
|
||||
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
|
||||
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
|
||||
70ea3768f1b3062b22d20644df41c86238157ec80dd43da40545c620714273c6 lib/core/target.py
|
||||
|
|
@ -574,7 +574,7 @@ dcdeed9ee285e63cf06baf8347e3db7f210ef25a63869bab78ce1ec6898ae191 tamper/unional
|
|||
ce1b6bf8f296de27014d6f21aa8b3df9469d418740cd31c93d1f5e36d6c509cf tamper/xforwardedfor.py
|
||||
44401cad3e39ae9fb899ed5d0e2fdd0879561de05c3117f17f3b0db54f4e3724 tests/__init__.py
|
||||
bfb553602eb5d20b4ab5928dbcf8e6a3e7e5ff69f7d30d1f53ef6d323c237f6c tests/test_agent.py
|
||||
d4d7d3525d25ce72bf38bd38b5fdf61144e381993d63be7dc72b2b4811ffab67 tests/test_bigarray.py
|
||||
feb763ddcbf4f32822372ca53f8c71c754af7b72510ef06e1e9c77927fc90b10 tests/test_bigarray.py
|
||||
27ad87c0ea377e0657bd6f6a4eaa0e9756aa9d28ec0483bdadeb3f66dcc4660d tests/test_charset.py
|
||||
9e678a56e16211c49ab4995b6c658d3f122bfa3b357d9e17ff38f5a489ace6ad tests/test_cloak.py
|
||||
a48c411fea864e6bcd6a1c7e1a35094b8cda8d15088fd9e7b0270542ae20daa9 tests/test_common_helpers.py
|
||||
|
|
|
|||
|
|
@ -172,6 +172,12 @@ class BigArray(list):
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
# Note: the formerly on-disk chunk is now an in-memory list (and its file has been
|
||||
# removed), so any cache entry still pointing at it is stale; dropping it prevents
|
||||
# serving outdated data if that chunk index is later re-dumped (e.g. append after pop)
|
||||
if isinstance(self.cache, Cache) and self.cache.index == idx:
|
||||
self.cache = None
|
||||
|
||||
return self.chunks[-1].pop()
|
||||
|
||||
def index(self, value):
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from lib.core.enums import OS
|
|||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.6.141"
|
||||
VERSION = "1.10.6.142"
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -80,6 +80,65 @@ class TestSpill(unittest.TestCase):
|
|||
self.assertEqual(restored[N - 1], "item-%d" % (N - 1))
|
||||
|
||||
|
||||
class TestCacheConsistency(unittest.TestCase):
|
||||
"""The on-disk chunk is served through a single-slot cache (read caching plus
|
||||
dirty write-back). These check that the cache never serves stale data."""
|
||||
|
||||
def test_setitem_writeback_across_chunks(self):
|
||||
ba = _make_spilled()
|
||||
ref = ["item-%d" % i for i in range(N)]
|
||||
# mutate elements spread across several different on-disk chunks
|
||||
for i in (0, 1, 499, 500, 2500, N - 1):
|
||||
ba[i] = ref[i] = "EDIT-%d" % i
|
||||
try:
|
||||
for i in (0, 1, 499, 500, 2500, N - 1):
|
||||
self.assertEqual(ba[i], ref[i], msg="readback ba[%d]" % i)
|
||||
self.assertEqual(list(ba), ref) # full independent traversal agrees
|
||||
finally:
|
||||
ba.close()
|
||||
|
||||
def test_dirty_edit_survives_pickle(self):
|
||||
ba = _make_spilled()
|
||||
ba[10] = "EDITED-LOW"
|
||||
ba[N - 10] = "EDITED-HIGH"
|
||||
restored = pickle.loads(pickle.dumps(ba))
|
||||
try:
|
||||
self.assertEqual(restored[10], "EDITED-LOW")
|
||||
self.assertEqual(restored[N - 10], "EDITED-HIGH")
|
||||
finally:
|
||||
restored.close()
|
||||
ba.close()
|
||||
|
||||
def test_pop_then_append_then_direct_read(self):
|
||||
# Regression: pop() reloads the last on-disk chunk into memory and deletes its
|
||||
# file, but a non-dirty cache entry still pointing at that chunk index was left
|
||||
# in place. A later append that re-dumps the chunk index then made the stale
|
||||
# cache serve outdated data on a direct __getitem__ (silent data corruption).
|
||||
ref = ["item-%d" % i for i in range(N)]
|
||||
ba = _make_spilled()
|
||||
try:
|
||||
cl = ba.chunk_length
|
||||
last = len(ba.chunks) - 2 # last on-disk chunk (tail is the in-memory list)
|
||||
base = last * cl
|
||||
|
||||
ba[base] # populate cache at idx=last, NOT dirty
|
||||
|
||||
while len(ba) > base + 1: # pop() reloads chunk 'last' from disk, removes its file
|
||||
ba.pop()
|
||||
ref.pop()
|
||||
|
||||
for i in range(cl): # re-dump chunk 'last' to a brand new temp file
|
||||
value = "NEW-%d" % i
|
||||
ba.append(value)
|
||||
ref.append(value)
|
||||
|
||||
# direct access to the re-dumped chunk, with no prior read to refresh the cache
|
||||
for off in range(cl):
|
||||
self.assertEqual(ba[base + off], ref[base + off], msg="offset %d" % off)
|
||||
finally:
|
||||
ba.close()
|
||||
|
||||
|
||||
class TestInMemorySmall(unittest.TestCase):
|
||||
def test_no_spill_for_small(self):
|
||||
ba = BigArray([1, 2, 3])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue