6 Commits

Author SHA1 Message Date
46f9947b64 feat: add expression precompilation API and custom function registry
- F14: compile(source) separated from evaluation so an expression can be
  parsed once and evaluated many times
- F15: register user-defined C++ functions callable from expressions,
  replacing the hardcoded method dispatch with a named registry
2026-08-20 14:00:27 +03:00
9a30408129 fix: correct scientific notation lexing, &&/|| return type, and Expr::kind init
- B1: malformed scientific notation (1e+, 1e-) no longer silently eats
  the following operator
- B2: && and || now consistently return booleans on every path (C-style
  semantics), instead of leaking the raw operand on the non-short-circuit
  path
- B3: example main.cpp passes the populated context instead of an empty
  object
- B4: give Expr::kind a default initializer to avoid reading an
  uninitialized enum
2026-08-20 14:00:19 +03:00
cda2e9daa7 fix: harden arithmetic, string ops, and lexer error handling
- S4: add isfinite checks after all arithmetic ops (Add, Sub, Mul, Div,
  Pow, Neg) so NaN/Infinity can never enter JSON output
- S5: fix is_integral_number INT64_MAX boundary check to eliminate
  undefined behaviour from double rounding
- S6: cap string concatenation result at MAX_STRING_SIZE (1MB)
- S7: add optional max_source_length parameter to test/eval_val/eval_true
- S8: catch std::out_of_range in lexNumber() and report a descriptive
  ParseError instead of a bare 'stod' message
2026-08-20 14:00:17 +03:00
9d5571b7d2 feat: critical security fixes - string repeat cap, parser/evaluator depth limits
- Cap string repeat to MAX_STRING_SIZE (1MB) to prevent DoS via integer overflow
- Consolidate duplicated string*number/number*string repeat blocks into helper
- Add parser depth counter (limit 512) to prevent stack overflow from nested parens/unary chains
- Add evaluator depth counter (limit 512) to prevent stack overflow during eval
- Add EvalError type for evaluation-time errors
- Add test cases for all security fixes
2026-08-20 01:14:52 +03:00
188b1e8e24 Rename mantis to mbs 2026-03-19 23:53:14 +03:00
68e60a3dc8 Initial Commit 2026-03-19 17:05:22 +03:00