← nischoy.ai

git Verification

SMT2 formal verification of security-critical code paths

ALL VERIFIED
Overall
23
Properties Checked
23
Verified
0
Failed

Protocol Version Bounds (0-2)

🌳 tree-sitter (partial) VERIFIED

Function: discover_version · Z3 solved in 0.1ms

Git protocol version is determined by enum {protocol_v0=0, protocol_v1=1, protocol_v2=2}. Extracted from discover_version() in connect.c.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun version () Int)
(assert
 (<= version 2))
(assert
 (>= version 0))
(assert
 (or (< version 0) (> version 2)))
(check-sat)

Protocol Version Allowed Set ({0,1,2})

🌳 tree-sitter VERIFIED

Function: discover_version · Z3 solved in 0.0ms

Protocol negotiation must resolve to an explicitly defined enum value, not just a numerically in-range value.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun version () Int)
(assert
 (let (($x29 (= version 2)))
 (let (($x28 (= version 1)))
 (let (($x27 (= version 0)))
 (or $x27 $x28 $x29)))))
(assert
 (let (($x29 (= version 2)))
(let (($x28 (= version 1)))
(let (($x27 (= version 0)))
(let (($x26 (or $x27 $x28 $x29)))
(not $x26))))))
(check-sat)

pkt-line Length Bounds (0-65520)

🌳 tree-sitter (partial) VERIFIED

Function: packet_read · Z3 solved in 0.0ms

pkt-line protocol limits packets to LARGE_PACKET_MAX (65520). Extracted from packet_read() in pkt-line.c.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun pkt_len () Int)
(assert
 (<= pkt_len 65520))
(assert
 (>= pkt_len 0))
(assert
 (or (< pkt_len 0) (> pkt_len 65520)))
(check-sat)

pkt-line Short Control Allowed Set ({0,1,2})

🌳 tree-sitter VERIFIED

Function: packet_read · Z3 solved in 0.0ms

pkt-line control framing reserves short lengths for 0000/0001/0002 only; 0003 is malformed and must be rejected.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun pkt_len () Int)
(assert
 (let (($x17 (= pkt_len 2)))
 (let (($x5 (= pkt_len 1)))
 (let (($x15 (= pkt_len 0)))
 (or $x15 $x5 $x17)))))
(assert
 (let (($x17 (= pkt_len 2)))
(let (($x5 (= pkt_len 1)))
(let (($x15 (= pkt_len 0)))
(let (($x35 (or $x15 $x5 $x17)))
(and (< pkt_len 4) (not $x35)))))))
(check-sat)

Hash Digest 32-bit Word Count Bounds (5-8)

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.4ms

Digest byte widths map to 32-bit word counts: SHA-1=20 bytes (5 words), SHA-256=32 bytes (8 words).

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x5 (= hash_rawsz 32)))
 (let (($x26 (= hash_rawsz 20)))
 (or $x26 $x5))))
(assert
 (or (and (distinct (mod hash_rawsz 4) 0) true) (< (div hash_rawsz 4) 5) (> (div hash_rawsz 4) 8)))
(check-sat)

Hash Raw Size Allowed Set (SHA-1/SHA-256)

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.0ms

Hash digest size must be exactly 20 (SHA-1) or 32 (SHA-256). From hash_algos[] compile-time initialization.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x33 (= hash_rawsz 32)))
 (let (($x28 (= hash_rawsz 20)))
 (or $x28 $x33))))
(assert
 (let (($x33 (= hash_rawsz 32)))
(let (($x28 (= hash_rawsz 20)))
(let (($x39 (or $x28 $x33)))
(not $x39)))))
(check-sat)

Tree Traversal Depth Bounds (0-4096)

🌳 tree-sitter (partial) VERIFIED

Function: read_tree_at · Z3 solved in 0.0ms

Tree traversal depth bounded to prevent stack exhaustion. From read_tree_at() recursion.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun tree_depth () Int)
(assert
 (<= tree_depth 4096))
(assert
 (>= tree_depth 0))
(assert
 (or (< tree_depth 0) (> tree_depth 4096)))
(check-sat)

Pathname Length Bounds (1-4096)

🌳 tree-sitter (partial) VERIFIED

Function: verify_path · Z3 solved in 0.0ms

Pathname length bounded by verify_path() in read-cache.c. OS PATH_MAX typically 4096.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun path_len () Int)
(assert
 (<= path_len 4096))
(assert
 (>= path_len 1))
(assert
 (or (< path_len 1) (> path_len 4096)))
(check-sat)

Object Type Enum Bounds (1-7)

🌳 tree-sitter VERIFIED

Function: object_type_enum · Z3 solved in 0.0ms

Object types range from OBJ_COMMIT=1 to OBJ_REF_DELTA=7. Defined in object.h enum.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun obj_type () Int)
(assert
 (<= obj_type 7))
(assert
 (>= obj_type 1))
(assert
 (or (< obj_type 1) (> obj_type 7)))
(check-sat)

Object Type Allowed Set ({1,2,3,4,6,7})

🌳 tree-sitter VERIFIED

Function: discover_version · Z3 solved in 0.0ms

Object type must be one of the defined types. Type 5 is reserved/invalid.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun obj_type () Int)
(assert
 (let (($x15 (= obj_type 7)))
 (let (($x11 (= obj_type 6)))
 (let (($x14 (= obj_type 4)))
 (let (($x13 (= obj_type 3)))
 (let (($x28 (= obj_type 2)))
 (let (($x16 (= obj_type 1)))
 (or $x16 $x28 $x13 $x14 $x11 $x15))))))))
(assert
 (let (($x15 (= obj_type 7)))
(let (($x11 (= obj_type 6)))
(let (($x14 (= obj_type 4)))
(let (($x13 (= obj_type 3)))
(let (($x28 (= obj_type 2)))
(let (($x16 (= obj_type 1)))
(let (($x35 (or $x16 $x28 $x13 $x14 $x11 $x15)))
(not $x35)))))))))
(check-sat)

Symbolic Ref Resolution Depth (0-5)

🌳 tree-sitter (partial) VERIFIED

Function: refs_resolve_ref_unsafe · Z3 solved in 0.0ms

Symbolic ref resolution limited to SYMREF_MAXDEPTH=5 to prevent infinite loops. From refs.c.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun symref_depth () Int)
(assert
 (<= symref_depth 5))
(assert
 (>= symref_depth 0))
(assert
 (or (< symref_depth 0) (> symref_depth 5)))
(check-sat)

Hash Algorithm ID Bounds (1-2)

🌳 tree-sitter (partial) VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.0ms

Hash algorithm ID: GIT_HASH_SHA1=1, GIT_HASH_SHA256=2. From repository.c.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_algo () Int)
(assert
 (<= hash_algo 2))
(assert
 (>= hash_algo 1))
(assert
 (or (< hash_algo 1) (> hash_algo 2)))
(check-sat)

Hash Algorithm Allowed Set ({1,2})

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.0ms

Hash algorithm must be one of the explicitly defined enum members (1 or 2).

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_algo () Int)
(assert
 (let (($x14 (= hash_algo 2)))
 (let (($x11 (= hash_algo 1)))
 (or $x11 $x14))))
(assert
 (let (($x14 (= hash_algo 2)))
(let (($x11 (= hash_algo 1)))
(let (($x13 (or $x11 $x14)))
(not $x13)))))
(check-sat)

Hash Algorithm ↔ Raw Size Coupling

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.1ms

SHA-1 must use rawsz=20, SHA-256 must use rawsz=32. Enforced by hash_algos[] array.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(declare-fun hash_algo () Int)
(assert
 (or (and (= hash_algo 1) (= hash_rawsz 20)) (and (= hash_algo 2) (= hash_rawsz 32))))
(assert
 (let (($x7 (or (and (= hash_algo 1) (= hash_rawsz 20)) (and (= hash_algo 2) (= hash_rawsz 32)))))
(not $x7)))
(check-sat)

Hash Algorithm ↔ Bit-Length Coupling

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.1ms

Digest bit-length must match selected algorithm: SHA-1=160 bits, SHA-256=256 bits.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(declare-fun hash_algo () Int)
(assert
 (or (and (= hash_algo 1) (= hash_rawsz 20)) (and (= hash_algo 2) (= hash_rawsz 32))))
(assert
 (let (($x66 (or (and (= hash_algo 1) (= (* hash_rawsz 8) 160)) (and (= hash_algo 2) (= (* hash_rawsz 8) 256)))))
(not $x66)))
(check-sat)

Hash Algorithm ↔ Hex-Length Coupling

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.1ms

Selected hash algorithm must produce canonical object ID hex width: SHA-1=40 chars, SHA-256=64 chars.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(declare-fun hash_algo () Int)
(assert
 (or (and (= hash_algo 1) (= hash_rawsz 20)) (and (= hash_algo 2) (= hash_rawsz 32))))
(assert
 (let (($x37 (or (and (= hash_algo 1) (= (* hash_rawsz 2) 40)) (and (= hash_algo 2) (= (* hash_rawsz 2) 64)))))
(not $x37)))
(check-sat)

Pack Object Header Length Bounds (1-10)

🌳 tree-sitter (partial) VERIFIED

Function: encode_in_pack_object_header · Z3 solved in 0.0ms

Pack object header is 1-MAX_PACK_OBJECT_HEADER(10) bytes. From encode_in_pack_object_header() in pack-write.c.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun header_len () Int)
(assert
 (<= header_len 10))
(assert
 (>= header_len 1))
(assert
 (or (< header_len 1) (> header_len 10)))
(check-sat)

Hash Raw Size Bounds (20-32)

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.1ms

Hash raw size ranges from 20 (SHA-1) to 32 (SHA-256).

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x57 (= hash_rawsz 32)))
 (let (($x61 (= hash_rawsz 20)))
 (or $x61 $x57))))
(assert
 (or (< hash_rawsz 20) (> hash_rawsz 32)))
(check-sat)

Hash Digest Bit-Length Bounds (160-256)

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.1ms

Hash digest bit-length: SHA-1=160, SHA-256=256.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x66 (= hash_rawsz 32)))
 (let (($x41 (= hash_rawsz 20)))
 (or $x41 $x66))))
(assert
 (or (< (* hash_rawsz 8) 160) (> (* hash_rawsz 8) 256)))
(check-sat)

Hash Digest Bit-Length Allowed Set ({160,256})

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.0ms

Hash digest bit-length must map exactly to supported algorithms: SHA-1=160, SHA-256=256.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x49 (= hash_rawsz 32)))
 (let (($x52 (= hash_rawsz 20)))
 (or $x52 $x49))))
(assert
 (let (($x14 (or (= (* hash_rawsz 8) 160) (= (* hash_rawsz 8) 256))))
(not $x14)))
(check-sat)

Hash Raw Size Word Alignment

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.3ms

Hash raw size must be 4-byte aligned: 20 and 32 are both word-aligned.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x20 (= hash_rawsz 32)))
 (let (($x12 (= hash_rawsz 20)))
 (or $x12 $x20))))
(assert
 (let ((?x57 (mod hash_rawsz 4)))
(and (distinct ?x57 0) true)))
(check-sat)

Hash Hex Length Allowed Set ({40,64})

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.0ms

Hex object IDs must be exactly 40 chars (SHA-1) or 64 chars (SHA-256), derived from hash raw size.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x12 (= hash_rawsz 32)))
 (let (($x37 (= hash_rawsz 20)))
 (or $x37 $x12))))
(assert
 (let (($x60 (or (= (* hash_rawsz 2) 40) (= (* hash_rawsz 2) 64))))
(not $x60)))
(check-sat)

Hash Raw Size Even Byte Alignment

🌳 tree-sitter VERIFIED

Function: repo_set_hash_algo · Z3 solved in 0.2ms

Hash raw size must be an even number of bytes to avoid half-byte (nibble) truncation during hex object ID handling.

View SMT2 Constraints
; benchmark generated from python API
(set-info :status unknown)
(declare-fun hash_rawsz () Int)
(assert
 (let (($x56 (= hash_rawsz 32)))
 (let (($x45 (= hash_rawsz 20)))
 (or $x45 $x56))))
(assert
 (let ((?x36 (mod hash_rawsz 2)))
(and (distinct ?x36 0) true)))
(check-sat)

Last verified: 2026-03-25 10:01:27 UTC · Solver: Z3 4.16.0