crosshair-tool 0.0.86__cp313-cp313-macosx_10_13_universal2.whl → 0.0.87__cp313-cp313-macosx_10_13_universal2.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of crosshair-tool might be problematic. Click here for more details.
- _crosshair_tracers.cpython-313-darwin.so +0 -0
- crosshair/__init__.py +1 -1
- crosshair/_mark_stacks.h +2 -19
- crosshair/auditwall.py +8 -5
- crosshair/libimpl/builtinslib.py +7 -17
- {crosshair_tool-0.0.86.dist-info → crosshair_tool-0.0.87.dist-info}/METADATA +2 -2
- {crosshair_tool-0.0.86.dist-info → crosshair_tool-0.0.87.dist-info}/RECORD +11 -11
- {crosshair_tool-0.0.86.dist-info → crosshair_tool-0.0.87.dist-info}/WHEEL +1 -1
- {crosshair_tool-0.0.86.dist-info → crosshair_tool-0.0.87.dist-info}/entry_points.txt +0 -0
- {crosshair_tool-0.0.86.dist-info → crosshair_tool-0.0.87.dist-info}/licenses/LICENSE +0 -0
- {crosshair_tool-0.0.86.dist-info → crosshair_tool-0.0.87.dist-info}/top_level.txt +0 -0
|
Binary file
|
crosshair/__init__.py
CHANGED
|
@@ -15,7 +15,7 @@ from crosshair.statespace import StateSpace
|
|
|
15
15
|
from crosshair.tracers import NoTracing, ResumedTracing
|
|
16
16
|
from crosshair.util import IgnoreAttempt, debug
|
|
17
17
|
|
|
18
|
-
__version__ = "0.0.
|
|
18
|
+
__version__ = "0.0.87" # Do not forget to update in setup.py!
|
|
19
19
|
__author__ = "Phillip Schanely"
|
|
20
20
|
__license__ = "MIT"
|
|
21
21
|
__status__ = "Alpha"
|
crosshair/_mark_stacks.h
CHANGED
|
@@ -538,23 +538,6 @@ static const uint8_t _ch_DE_INSTRUMENT[256] = {
|
|
|
538
538
|
#endif
|
|
539
539
|
#endif
|
|
540
540
|
|
|
541
|
-
/* Get the underlying opcode, stripping instrumentation */
|
|
542
|
-
int _ch_Py_GetBaseOpcode(PyCodeObject *code, int i)
|
|
543
|
-
{
|
|
544
|
-
int opcode = _PyCode_CODE(code)[i].op.code;
|
|
545
|
-
if (opcode == INSTRUMENTED_LINE) {
|
|
546
|
-
opcode = code->_co_monitoring->lines[i].original_opcode;
|
|
547
|
-
}
|
|
548
|
-
if (opcode == INSTRUMENTED_INSTRUCTION) {
|
|
549
|
-
opcode = code->_co_monitoring->per_instruction_opcodes[i];
|
|
550
|
-
}
|
|
551
|
-
int deinstrumented = _ch_DE_INSTRUMENT[opcode];
|
|
552
|
-
if (deinstrumented) {
|
|
553
|
-
return deinstrumented;
|
|
554
|
-
}
|
|
555
|
-
return _ch_PyOpcode_Deopt[opcode];
|
|
556
|
-
}
|
|
557
|
-
|
|
558
541
|
static int64_t *
|
|
559
542
|
_ch_mark_stacks(PyCodeObject *code_obj, int len)
|
|
560
543
|
{
|
|
@@ -602,14 +585,14 @@ _ch_mark_stacks(PyCodeObject *code_obj, int len)
|
|
|
602
585
|
/* Scan instructions */
|
|
603
586
|
for (i = 0; i < len;) {
|
|
604
587
|
int64_t next_stack = stacks[i];
|
|
605
|
-
opcode =
|
|
588
|
+
opcode = code[i].op.code;
|
|
606
589
|
uint8_t trace_enabled_here = _ch_TRACABLE_INSTRUCTIONS[opcode];
|
|
607
590
|
enabled_tracing[i] |= trace_enabled_here;
|
|
608
591
|
int oparg = 0;
|
|
609
592
|
while (opcode == EXTENDED_ARG) {
|
|
610
593
|
oparg = (oparg << 8) | code[i].op.arg;
|
|
611
594
|
i++;
|
|
612
|
-
opcode =
|
|
595
|
+
opcode = code[i].op.code;
|
|
613
596
|
stacks[i] = next_stack;
|
|
614
597
|
}
|
|
615
598
|
int next_i = i + _ch_PyOpcode_Caches[opcode] + 1;
|
crosshair/auditwall.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import importlib
|
|
2
|
+
import inspect
|
|
2
3
|
import os
|
|
3
4
|
import sys
|
|
4
5
|
import traceback
|
|
@@ -28,9 +29,10 @@ def reject(event: str, args: Tuple) -> None:
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
def inside_module(modules: Iterable[ModuleType]) -> bool:
|
|
31
|
-
|
|
32
|
-
for frame,
|
|
33
|
-
|
|
32
|
+
"""Checks whether the current call stack is inside one of the given modules."""
|
|
33
|
+
for frame, _lineno in traceback.walk_stack(None):
|
|
34
|
+
frame_module = inspect.getmodule(frame)
|
|
35
|
+
if frame_module and frame_module in modules:
|
|
34
36
|
return True
|
|
35
37
|
return False
|
|
36
38
|
|
|
@@ -60,7 +62,7 @@ def check_msvcrt_open(event: str, args: Tuple) -> None:
|
|
|
60
62
|
_MODULES_THAT_CAN_POPEN: Optional[Set[ModuleType]] = None
|
|
61
63
|
|
|
62
64
|
|
|
63
|
-
def
|
|
65
|
+
def modules_with_allowed_subprocess():
|
|
64
66
|
global _MODULES_THAT_CAN_POPEN
|
|
65
67
|
if _MODULES_THAT_CAN_POPEN is None:
|
|
66
68
|
allowed_module_names = ("_aix_support", "ctypes", "platform", "uuid")
|
|
@@ -74,13 +76,14 @@ def modules_with_allowed_popen():
|
|
|
74
76
|
|
|
75
77
|
|
|
76
78
|
def check_subprocess(event: str, args: Tuple) -> None:
|
|
77
|
-
if not inside_module(
|
|
79
|
+
if not inside_module(modules_with_allowed_subprocess()):
|
|
78
80
|
reject(event, args)
|
|
79
81
|
|
|
80
82
|
|
|
81
83
|
_SPECIAL_HANDLERS = {
|
|
82
84
|
"open": check_open,
|
|
83
85
|
"subprocess.Popen": check_subprocess,
|
|
86
|
+
"os.posix_spawn": check_subprocess,
|
|
84
87
|
"msvcrt.open_osfhandle": check_msvcrt_open,
|
|
85
88
|
}
|
|
86
89
|
|
crosshair/libimpl/builtinslib.py
CHANGED
|
@@ -267,7 +267,7 @@ class SymbolicValue(CrossHairValue):
|
|
|
267
267
|
self.snapshot = SnapshotRef(-1)
|
|
268
268
|
self.python_type = typ
|
|
269
269
|
if type(smtvar) is str:
|
|
270
|
-
self.var = self.__init_var__(typ, smtvar)
|
|
270
|
+
self.var: Any = self.__init_var__(typ, smtvar)
|
|
271
271
|
else:
|
|
272
272
|
self.var = smtvar
|
|
273
273
|
# TODO test that smtvar's sort matches expected?
|
|
@@ -838,19 +838,6 @@ def setup_binops():
|
|
|
838
838
|
|
|
839
839
|
setup_binop(_, {ops.lshift, ops.rshift})
|
|
840
840
|
|
|
841
|
-
_AND_MASKS_TO_MOD = {
|
|
842
|
-
# It's common to use & to mask low bits. We can avoid realization by converting
|
|
843
|
-
# these situations into mod operations.
|
|
844
|
-
0x01: 2,
|
|
845
|
-
0x03: 4,
|
|
846
|
-
0x07: 8,
|
|
847
|
-
0x0F: 16,
|
|
848
|
-
0x1F: 32,
|
|
849
|
-
0x3F: 64,
|
|
850
|
-
0x7F: 128,
|
|
851
|
-
0xFF: 256,
|
|
852
|
-
}
|
|
853
|
-
|
|
854
841
|
def _(op: BinFn, a: Integral, b: Integral):
|
|
855
842
|
with NoTracing():
|
|
856
843
|
if isinstance(b, SymbolicInt):
|
|
@@ -861,9 +848,12 @@ def setup_binops():
|
|
|
861
848
|
b = realize(b)
|
|
862
849
|
if b == 0:
|
|
863
850
|
return 0
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
851
|
+
# It's common to use & to mask low bits. We can avoid realization by converting
|
|
852
|
+
# these situations into mod operations.
|
|
853
|
+
mask_mod = b + 1
|
|
854
|
+
if b > 0 and mask_mod & b == 0 and isinstance(a, SymbolicInt): # type: ignore
|
|
855
|
+
space = context_statespace()
|
|
856
|
+
if space.smt_fork(a.var >= 0, probability_true=0.75):
|
|
867
857
|
return SymbolicInt(a.var % mask_mod)
|
|
868
858
|
else:
|
|
869
859
|
return SymbolicInt(b - ((-a.var - 1) % mask_mod))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crosshair-tool
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.87
|
|
4
4
|
Summary: Analyze Python code for correctness using symbolic execution.
|
|
5
5
|
Home-page: https://github.com/pschanely/CrossHair
|
|
6
6
|
Author: Phillip Schanely
|
|
@@ -46,7 +46,7 @@ Requires-Dist: pytest-xdist; extra == "dev"
|
|
|
46
46
|
Requires-Dist: setuptools; extra == "dev"
|
|
47
47
|
Requires-Dist: sphinx>=3.4.3; extra == "dev"
|
|
48
48
|
Requires-Dist: sphinx-rtd-theme>=0.5.1; extra == "dev"
|
|
49
|
-
Requires-Dist:
|
|
49
|
+
Requires-Dist: rst2pdf>=0.102; extra == "dev"
|
|
50
50
|
Dynamic: author
|
|
51
51
|
Dynamic: author-email
|
|
52
52
|
Dynamic: classifier
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
_crosshair_tracers.cpython-313-darwin.so,sha256=
|
|
1
|
+
_crosshair_tracers.cpython-313-darwin.so,sha256=UROMO1abqw-cEi3ZoTdYccYz5i0mvZSONbdoDVLUgHE,140512
|
|
2
2
|
crosshair/_tracers_pycompat.h,sha256=6IYnbQxrYkhBsLDAHSX25DPOwo1oYHCZUVWZ8c7YCnQ,14356
|
|
3
3
|
crosshair/pure_importer.py,sha256=-t4eowrZOQmfqK1N2tjI5POoaxRGavytwMmbRivelFg,878
|
|
4
4
|
crosshair/options.py,sha256=htQNgnrpoRjSNq6rfLBAF8nos-NNIwmP6tQYyI8ugsM,6775
|
|
@@ -23,7 +23,7 @@ crosshair/fnutil.py,sha256=X80bD2Lh4QAh-rF561r3JRxjxcuZepF3hJaxaj1GG9s,13123
|
|
|
23
23
|
crosshair/unicode_categories.py,sha256=g4pnUPanx8KkpwI06ZUGx8GR8Myruf_EpTjyti_V4z8,333519
|
|
24
24
|
crosshair/copyext.py,sha256=GBGQP9YAHoezLXwb_M59Hh1VXSou5EQt4ZmmUA0T_og,4899
|
|
25
25
|
crosshair/_tracers_test.py,sha256=KpCGspjOUeZuhwTYgn_RxI4M4wMbT5rldusFDgneQ6M,3596
|
|
26
|
-
crosshair/__init__.py,sha256=
|
|
26
|
+
crosshair/__init__.py,sha256=pCHAq8T8tcr3KLNCJY6xCK4MAWSn-XIiJTIrjTaMpPE,936
|
|
27
27
|
crosshair/core.py,sha256=K7147xrvcvtrP1T9oIRywq2uHMMsIu8ZwFZWBQXPozg,63634
|
|
28
28
|
crosshair/path_cover.py,sha256=wV0Vy8IPDzqXQ2VI8a94FxltS9p-Y1oF17OKePjvpgs,6710
|
|
29
29
|
crosshair/enforce_test.py,sha256=C6CQ4P1FjkdIJeJg3aJynp1iLDCE6BFCEVtSqXbvmQk,4665
|
|
@@ -32,7 +32,7 @@ crosshair/core_test.py,sha256=H6qZFBFuUhgh9qWgxxc1Cs7xuC8s6FYvewmTYUh0Dpg,32200
|
|
|
32
32
|
crosshair/codeconfig.py,sha256=GgF-ND8Ha3FysSTQ-JuezHjlhGVBbo5aCJov1Ps3VSE,3959
|
|
33
33
|
crosshair/util_test.py,sha256=_KTQ0O4cLhF1pAeB8Y8Cyqbd0UyZf5KxJUaiA-ew-tE,4676
|
|
34
34
|
crosshair/watcher_test.py,sha256=Ef1YSwy68wWPR5nPjwvEKPqxltI9pE9lTbnesmDy3Bk,2764
|
|
35
|
-
crosshair/auditwall.py,sha256=
|
|
35
|
+
crosshair/auditwall.py,sha256=sqOmfXQLgmGfWS7b8SmVv66eFM2owaGn-4Ppq453VLI,5138
|
|
36
36
|
crosshair/simplestructs_test.py,sha256=6uDdrSISHLhwnFuESkR8mUGw7m1llM6vCNDFChkfSs8,8639
|
|
37
37
|
crosshair/z3util_test.py,sha256=CZovn4S9mYcG_yQegcxm80VHrvUdvNei0gvGTF9TOrk,173
|
|
38
38
|
crosshair/diff_behavior.py,sha256=_5X_pTN0_-rSPrh8dfpODJG_phFMn7fWc-_zLgO3UTk,11253
|
|
@@ -43,7 +43,7 @@ crosshair/stubs_parser_test.py,sha256=0itTT0Udul_51RJXNv6KB97z44gYze6NZfKJL7yIDz
|
|
|
43
43
|
crosshair/options_test.py,sha256=lzA-XtwEwQPa4wV1wwhCRKhyLOvIhThU9WK5QRaRbxQ,379
|
|
44
44
|
crosshair/patch_equivalence_test.py,sha256=mvYpsbHZS2AiQra-jK8T8QywAG1gNNCUNQPPWI9k5t8,2506
|
|
45
45
|
crosshair/abcstring.py,sha256=ROU8LzS7kfEU2L_D3QfhVxIjrYr1VctwUWfylC7KlCc,6549
|
|
46
|
-
crosshair/_mark_stacks.h,sha256=
|
|
46
|
+
crosshair/_mark_stacks.h,sha256=j86qubOUvVhoR19d74iQ084RrTEq8M6oT4wJsGQUySY,28678
|
|
47
47
|
crosshair/fuzz_core_test.py,sha256=q7WsZt6bj5OJrXaVsT3JaRYWWnL8X_1flSfty4Z7CcA,16903
|
|
48
48
|
crosshair/unicode_categories_test.py,sha256=ZAU37IDGm9PDvwy_CGFcrF9Waa8JuUNdI4aq74wkB6c,739
|
|
49
49
|
crosshair/statespace_test.py,sha256=LOblIarBbcB9oD_gVR5kK_4P2PWQymVGgJr3wNqP3Fs,2621
|
|
@@ -107,7 +107,7 @@ crosshair/libimpl/binascii_test.py,sha256=LOBqLAJ77Kx8vorjVTaT3X0Z93zw4P5BvwUapM
|
|
|
107
107
|
crosshair/libimpl/collectionslib_test.py,sha256=3h7XTToKWauMhjrEwLXVI0jT8FZKBlkvlw0oiPMmuKM,9164
|
|
108
108
|
crosshair/libimpl/timelib.py,sha256=MXEFOZjFGa1-yLvmB3l3DFTLF9PSluOlmRK-ZJaA_oI,2409
|
|
109
109
|
crosshair/libimpl/jsonlib_test.py,sha256=U40WJf-69dtflz75sIsl5zA3IV5R6Ltc4Z9jv_Fh-Fw,1382
|
|
110
|
-
crosshair/libimpl/builtinslib.py,sha256=
|
|
110
|
+
crosshair/libimpl/builtinslib.py,sha256=NjTvFTdPwQcBWC4PWmnD73rK37eXUp3pdwRoz2-IBEI,171512
|
|
111
111
|
crosshair/libimpl/mathlib_test.py,sha256=QShLCXHdv3tx5PQxcSoR0MHeZ1huaiV6d3u7C2mGOn4,1861
|
|
112
112
|
crosshair/libimpl/fractionlib.py,sha256=qdbiAHHC480YdKq3wYK_piZ3UD7oT64YfuNclypMUfQ,458
|
|
113
113
|
crosshair/libimpl/binascii_ch_test.py,sha256=hFqSfF1Q8jl2LNBIWaQ6vBJIIshPOmSwrR0T1Ko4Leo,1009
|
|
@@ -166,9 +166,9 @@ crosshair/libimpl/encodings/ascii.py,sha256=Cz1xraTkXdQ5aBKDkorX4rAvrmf877_EqzC9
|
|
|
166
166
|
crosshair/libimpl/encodings/__init__.py,sha256=5LTEj1M-S00eZ4rfQWczAixg57vyh_9vZ5m5EKB5Ksc,680
|
|
167
167
|
crosshair/libimpl/encodings/latin_1.py,sha256=ftUsPjUb9L7UKXKi9P7OAqOl9FkNP98M9jMAvseXBCQ,1242
|
|
168
168
|
crosshair/libimpl/encodings/_encutil.py,sha256=nwVWqcGM1f7-hAC3Z46KnfrLzAjhfy4zaTa11uVBk6M,6828
|
|
169
|
-
crosshair_tool-0.0.
|
|
170
|
-
crosshair_tool-0.0.
|
|
171
|
-
crosshair_tool-0.0.
|
|
172
|
-
crosshair_tool-0.0.
|
|
173
|
-
crosshair_tool-0.0.
|
|
174
|
-
crosshair_tool-0.0.
|
|
169
|
+
crosshair_tool-0.0.87.dist-info/RECORD,,
|
|
170
|
+
crosshair_tool-0.0.87.dist-info/WHEEL,sha256=YOKbiIEZep2WTRrpKV0dvEfsSeIOVH2NqduVxoKQt6I,142
|
|
171
|
+
crosshair_tool-0.0.87.dist-info/entry_points.txt,sha256=u5FIPVn1jqn4Kzg5K_iNnbP6L4hQw5FWjQ0UMezG2VE,96
|
|
172
|
+
crosshair_tool-0.0.87.dist-info/top_level.txt,sha256=2jLWtM-BWg_ZYNbNfrcds0HFZD62a6J7ZIbcgcQrRk4,29
|
|
173
|
+
crosshair_tool-0.0.87.dist-info/METADATA,sha256=5fceVgbFzOQhEoI4B8xJdNGOUd2aAftv63dxpz6Dp0E,6726
|
|
174
|
+
crosshair_tool-0.0.87.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459
|
|
File without changes
|
|
File without changes
|
|
File without changes
|