crosshair-tool 0.0.86__cp311-cp311-musllinux_1_2_i686.whl → 0.0.87__cp311-cp311-musllinux_1_2_i686.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/__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.86" # Do not forget to update in setup.py!
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 = _ch_Py_GetBaseOpcode(code_obj, i);
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 = _ch_Py_GetBaseOpcode(code_obj, i);
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
- files = {m.__file__ for m in modules}
32
- for frame, lineno in traceback.walk_stack(None):
33
- if frame.f_code.co_filename in files:
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 modules_with_allowed_popen():
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(modules_with_allowed_popen()):
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
 
@@ -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
- mask_mod = _AND_MASKS_TO_MOD.get(b)
865
- if mask_mod and isinstance(a, SymbolicInt):
866
- if context_statespace().smt_fork(a.var >= 0, probability_true=0.75):
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.86
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: wheel; extra == "dev"
49
+ Requires-Dist: rst2pdf>=0.102; extra == "dev"
50
50
  Dynamic: author
51
51
  Dynamic: author-email
52
52
  Dynamic: classifier
@@ -1,13 +1,13 @@
1
1
  _crosshair_tracers.cpython-311-i386-linux-musl.so,sha256=GbVSqJvqae4KE6ihhJbVPBzBLkACBggSgUS_2TowLFM,63688
2
- crosshair/__init__.py,sha256=BqE2fB9um9PltLa0yX7EVsyAzVpgDe5EBvIiEhQ2exI,936
2
+ crosshair/__init__.py,sha256=pCHAq8T8tcr3KLNCJY6xCK4MAWSn-XIiJTIrjTaMpPE,936
3
3
  crosshair/__main__.py,sha256=zw9Ylf8v2fGocE57o4FqvD0lc7U4Ld2GbeCGxRWrpqo,252
4
- crosshair/_mark_stacks.h,sha256=rvIET5OGjKMcUZxEtIb9RhxRDveAfPXb3HLZZWfM3Bs,29261
4
+ crosshair/_mark_stacks.h,sha256=j86qubOUvVhoR19d74iQ084RrTEq8M6oT4wJsGQUySY,28678
5
5
  crosshair/_preliminaries_test.py,sha256=r2PohNNMfIkDqsnvI6gKlJTbwBaZA9NQJueQfJMN2Eo,504
6
6
  crosshair/_tracers.h,sha256=qaDWd-_eCZckSbezrXXst6lppzFiM2kD2AcZgvVQm18,2124
7
7
  crosshair/_tracers_pycompat.h,sha256=6IYnbQxrYkhBsLDAHSX25DPOwo1oYHCZUVWZ8c7YCnQ,14356
8
8
  crosshair/_tracers_test.py,sha256=KpCGspjOUeZuhwTYgn_RxI4M4wMbT5rldusFDgneQ6M,3596
9
9
  crosshair/abcstring.py,sha256=ROU8LzS7kfEU2L_D3QfhVxIjrYr1VctwUWfylC7KlCc,6549
10
- crosshair/auditwall.py,sha256=FjpeqM6HxsKYEfVJ20CRzkQu1I2zt1dpzwejrDp-W9U,4975
10
+ crosshair/auditwall.py,sha256=sqOmfXQLgmGfWS7b8SmVv66eFM2owaGn-4Ppq453VLI,5138
11
11
  crosshair/auditwall_test.py,sha256=VPcw_OW3nl3BkOZY4wEEtVDyTamdgqD4IjRccI2p5vI,2030
12
12
  crosshair/codeconfig.py,sha256=GgF-ND8Ha3FysSTQ-JuezHjlhGVBbo5aCJov1Ps3VSE,3959
13
13
  crosshair/codeconfig_test.py,sha256=RnC-RnNpr6If4eHmOepDZ33MCmfyhup08dzHKCm5xWA,3350
@@ -100,7 +100,7 @@ crosshair/libimpl/binascii_ch_test.py,sha256=hFqSfF1Q8jl2LNBIWaQ6vBJIIshPOmSwrR0
100
100
  crosshair/libimpl/binascii_test.py,sha256=LOBqLAJ77Kx8vorjVTaT3X0Z93zw4P5BvwUapMCiSLg,1970
101
101
  crosshair/libimpl/binasciilib.py,sha256=9w4C37uxRNOmz9EUuhJduHlMKn0f7baY5fwwdvx1uto,5070
102
102
  crosshair/libimpl/bisectlib_test.py,sha256=ZQtYmBYD0Pb1IiFelsgdvqyeUMKaqaDb1BRb87LTSbI,753
103
- crosshair/libimpl/builtinslib.py,sha256=9qAV1xZ2oZrIrpfWQ3BXgnY0nK2Gjov4v207x43lTq4,171629
103
+ crosshair/libimpl/builtinslib.py,sha256=NjTvFTdPwQcBWC4PWmnD73rK37eXUp3pdwRoz2-IBEI,171512
104
104
  crosshair/libimpl/builtinslib_ch_test.py,sha256=W4wWapqlxSjsC5XgREfgxS9e_iwKxgNQhbFE3umUfNI,30504
105
105
  crosshair/libimpl/builtinslib_test.py,sha256=Q0DvH7Q_Ja0Tg83enhB_y_Pdau_S-bA6ztorjvgl4Mw,90275
106
106
  crosshair/libimpl/codecslib.py,sha256=lB87T1EYSBh4JXaqzjSpQG9CMfKtgckwA7f6OIR0S-Q,2668
@@ -166,9 +166,9 @@ crosshair/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
166
166
  crosshair/tools/check_help_in_doc.py,sha256=P21AH3mYrTVuBgWD6v65YXqBqmqpQDUTQeoZ10rB6TU,8235
167
167
  crosshair/tools/check_init_and_setup_coincide.py,sha256=kv61bXqKSKF_5J-kLNEhCrCPyszg7iZQWDu_Scnec98,3502
168
168
  crosshair/tools/generate_demo_table.py,sha256=0SeO0xQdiT-mbLNHt4rYL0wcc2DMh0v3qtzBdoQonDk,3831
169
- crosshair_tool-0.0.86.dist-info/METADATA,sha256=8n0ualxjh4y_waUzDZfliJjet2bID8tHk6kQIiwX2-M,6717
170
- crosshair_tool-0.0.86.dist-info/WHEEL,sha256=syr86pcT3Cl0FpIgpcFPtgZItPzayA2Bmuv28YP3HSo,110
171
- crosshair_tool-0.0.86.dist-info/entry_points.txt,sha256=u5FIPVn1jqn4Kzg5K_iNnbP6L4hQw5FWjQ0UMezG2VE,96
172
- crosshair_tool-0.0.86.dist-info/top_level.txt,sha256=2jLWtM-BWg_ZYNbNfrcds0HFZD62a6J7ZIbcgcQrRk4,29
173
- crosshair_tool-0.0.86.dist-info/RECORD,,
174
- crosshair_tool-0.0.86.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459
169
+ crosshair_tool-0.0.87.dist-info/METADATA,sha256=5fceVgbFzOQhEoI4B8xJdNGOUd2aAftv63dxpz6Dp0E,6726
170
+ crosshair_tool-0.0.87.dist-info/WHEEL,sha256=6ltumPE74Em2X1OXYv5iIjaGYcDTCG-wPLy9Dk1DJEw,110
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/RECORD,,
174
+ crosshair_tool-0.0.87.dist-info/licenses/LICENSE,sha256=NVyMvNqn1pH6RSHs6RWRcJyJvORnpgGFBlF73buqYJ0,4459
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp311-cp311-musllinux_1_2_i686
5
5