fix: comprehensive bug audit — 15 critical/high/medium fixes

Critical fixes:
- B-Tree splitChild: fixed out-of-bounds on child.children.len (mid+1..len → mid+1..<len)
- Wire protocol: all deserializeValue cases now properly assign to result
- Wire protocol: fkBool/fkInt8 now increment pos after reading
- MVCC: write-write conflict now detected for completed transactions
- MVCC: commit only marks visible versions as deleted (not concurrent uncommitted)
- Lexer: buffer overrun on backslash escape at end of input — added bounds check
- Bulgarian/Russian stemmers: fixed UTF-8 byte offsets for Cyrillic suffixes (2 bytes per char)

High fixes:
- WebSocket: added missing std/tables import
- Raft: added randomize() call for election timeouts
- MemTable.get: binary search O(log n) instead of linear scan O(n)

Medium fixes:
- Zerocopy: string length now written as 4-byte int32 (was single byte)
- Raft appendEntries: guard against nextIdx underflow
- Columnar: null tracking with nulls seq on ColumnPtr
- Removed dead code in lexer readIdent (redundant true/false checks)
- Updated Bulgarian stemming test to match corrected byte offsets

All 214 tests pass across 48 suites with 0 failures.
This commit is contained in:
2026-05-06 02:46:24 +03:00
parent c6de13ef7a
commit 805dbc8ad6
11 changed files with 89 additions and 55 deletions
+1 -4
View File
@@ -260,6 +260,7 @@ proc readString(l: var Lexer, quote: char): string =
while l.pos < l.input.len and l.input[l.pos] != quote:
if l.input[l.pos] == '\\':
discard l.advance()
if l.pos >= l.input.len: break
case l.input[l.pos]
of 'n': result.add('\n')
of 't': result.add('\t')
@@ -295,10 +296,6 @@ proc readIdent(l: var Lexer, startLine, startCol: int): Token =
let lowerIdent = ident.toLower()
if lowerIdent in keywords:
Token(kind: keywords[lowerIdent], value: ident, line: startLine, col: startCol)
elif lowerIdent == "true":
Token(kind: tkBoolLit, value: "true", line: startLine, col: startCol)
elif lowerIdent == "false":
Token(kind: tkBoolLit, value: "false", line: startLine, col: startCol)
else:
Token(kind: tkIdent, value: ident, line: startLine, col: startCol)