Diego Augusto Molina and GitHub
a23efbf4d0
fix VM not clearing memory references when reused ( #813 )
2025-07-05 13:46:48 +02:00
Anton Medvedev and GitHub
037ef3dc3d
Add expr.MaxNodes() option ( #799 )
...
* Add expr.MaxNodes() option
* Fix error message
* Add more tests and comments
2025-06-03 17:31:46 +02:00
Anton Medvedev
31f0ab00dc
Remove duplicated dereferences
2025-03-10 13:52:54 +01:00
Anton Medvedev
3d52b8e334
Fix func calls with nil types value
...
Fixes #688
2025-03-08 13:54:55 +01:00
Anton Medvedev
b42839dddb
Remove additional run API (RunWithConfig) from VM
...
This API was introduced in previous PR, but we do not want to expose it.
2025-03-07 15:06:45 +01:00
9dd86858e1
feat: add node budget and memory limits ( #762 )
...
* feat: add node budget and memory limits
Implement compile-time and runtime safeguards against deeply nested expressions:
- Add MaxNodes limit to track and limit AST node count during parsing
- Move MemoryBudget from VM to Config for better configurability
- Add node creation tracking in parser to enforce node budget
- Refactor node creation to check limits before allocation
- Add RunWithConfig to VM for passing memory budget settings
- Set reasonable defaults in Config (10000 nodes, 1M memory)
- Add comprehensive tests for both node and memory limits
This prevents stack overflows from malicious or poorly written expressions
by failing fast with clear error messages during compilation or runtime.
Signed-off-by: Ville Vesilehto <[email protected] >
* Update parser.go
Signed-off-by: Anton Medvedev <[email protected] >
---------
Signed-off-by: Ville Vesilehto <[email protected] >
Signed-off-by: Anton Medvedev <[email protected] >
Co-authored-by: Anton Medvedev <[email protected] >
2025-03-07 14:09:41 +01:00
Anton Medvedev and GitHub
19b2c3848f
Add checks for nil before string casts in VM ( #654 )
2024-05-17 19:40:20 +02:00
Anton Medvedev and GitHub
46d295876f
Add spans
2024-02-29 20:51:34 +01:00
Anton Medvedev and GitHub
0d43107999
Add concat() builtin ( #565 )
...
* Add concat() builtin
* Use pkg deref in builtin
* Use pkg deref in checker
* Use pkg deref in types_table.go
* Use pkg deref in docgen.go
* Use pkg deref in vm
2024-02-16 22:32:35 +01:00
Anton Medvedev and GitHub
b1e82de54a
Refactor groupBy and sortBy ( #562 )
...
* Rearrange opcodes
* Refactor groupBy
* Fix tests
* Super opcodes for GroupBy
* Refactor sortBy builtin
* Fix sortBy bench
2024-02-15 19:53:35 +01:00
Anton Medvedev
fdae534aa9
Add OpCallSafe
2024-02-12 22:15:17 +01:00
Anton Medvedev and GitHub
010c934215
Fix race cond in variabels ( #523 )
...
* Add race cond test
* Move variables array to vm
* Resize vars array for different programs
2024-01-13 20:41:14 +01:00
Anton Medvedev and GitHub
74e30b9ecd
Add build tag: expr_debug ( #521 )
2024-01-13 13:14:38 +01:00
Anton Medvedev and GitHub
79bb049707
Add [generated] tags to files ( #518 )
2024-01-12 21:58:13 +01:00
Anton Medvedev and GitHub
d903980830
Add mem grow to builtin ( #505 )
...
* Add mem grow to builtin
* Add OpValidateArgs opcode
2023-12-30 12:49:43 +01:00
Anton Medvedev
551d2a7e0f
Use expr-lang/expr
2023-12-03 21:53:01 +01:00
Anton Medvedev
2cf93593f4
Hide fields in vm.Program
2023-11-27 13:52:56 +01:00
Anton Medvedev
4daca7fa08
Update vm.go
2023-09-06 09:42:58 +02:00
Anton Medvedev
3d460e5519
Fix negative ranges memory budget
2023-09-03 11:25:31 +02:00
Anton Medvedev
05d700f4ea
Change memoryBudget type to uint
...
Fixes #427
2023-09-03 11:13:50 +02:00
Anton Medvedev
6d8d2390cf
Remove countBy
2023-08-30 14:55:05 +02:00
Anton Medvedev
5023b3005d
Add reduce()
2023-08-30 13:33:16 +02:00
Anton Medvedev
7f85c0551f
Add countBy()
2023-08-30 12:07:16 +02:00
Anton Medvedev
32f5fde2eb
Replace interface{} with any
2023-08-30 11:25:15 +02:00
Anton Medvedev
3f57b885d4
Add groupBy
2023-08-30 11:14:54 +02:00
Anton Medvedev
9a9cab2e4a
Add sort builtin
2023-08-28 14:55:44 +02:00
Anton Medvedev
166d8b8ce9
Add filter()[-1] optimization
2023-08-24 11:15:43 +02:00
Anton Medvedev
8c52bd6d8b
Add filter()[0] optimization
2023-08-24 11:15:43 +02:00
Anton Medvedev
2c139ca36a
Add find() and findIndex()
2023-08-24 11:15:43 +02:00
Anton Medvedev
ed5f9bfbcb
Add variables
2023-08-22 22:30:07 +02:00
Anton Medvedev
4ae978d384
Allow to disable builtins
2023-08-19 22:24:42 +02:00
Anton Medvedev
9598368114
Improve OpCallTyped performance
2023-08-14 16:06:22 +02:00
Anton Medvedev
719f30d3ad
Add builtin functions
2023-08-14 15:37:06 +02:00
Anton Medvedev
67bd8e364d
Add string() builtin
2023-08-14 13:06:29 +02:00
Anton Medvedev
8177d8bd9f
Add OpCallBuiltin opcode to avoid an extra allocation
2023-08-14 11:50:42 +02:00
Anton Medvedev
8d959ea2fe
Refactor builtin.Function and move builtin funcs to builtin package
2023-08-14 11:50:42 +02:00
Anton Medvedev
756bf2f9b1
Add OpInvalid
2023-07-19 17:19:59 +04:00
Anton Medvedev
fda73cd719
Fix OpLoadEnv disassemble
2023-07-19 17:09:45 +04:00
mdmcconnell and GitHub
4e57a43464
env[] keyword implemented in parser ( #382 )
2023-07-12 11:01:19 +02:00
hesining and GitHub
9255e223d9
Add Wrap and Unwrap method to hold self error ( #352 )
2023-03-10 21:08:40 +01:00
Anton Medvedev
95f8b7ff17
Add nil coalescing operator
2023-02-03 15:53:43 +01:00
Anton Medvedev
3e919ad53f
Unflatten builtins opcodes
2023-01-30 22:24:35 +01:00
Anton Medvedev
12a40c72cb
Flatten builtin opcodes in vm
2023-01-30 22:24:35 +01:00
Anton Medvedev
a469abd32b
Add int() and float() builtins
2023-01-29 20:34:15 +01:00
Anton Medvedev
b737180582
Improve builtin performance
2023-01-29 20:34:15 +01:00
Anton Medvedev
72a4ce18e9
Add len() builtin
2023-01-29 20:34:15 +01:00
Anton Medvedev
4b7c89eff1
Add expr.Function feature
2023-01-29 20:34:15 +01:00
Anton Medvedev
9777db3f2a
Fix: correctly check error type of func return types
2023-01-21 13:34:33 +01:00
Anton Medvedev
247fc09c06
Rename opcodes
2022-11-12 14:40:05 +01:00
Anton Medvedev
6829eb018b
Rename opcodes
2022-11-12 14:38:35 +01:00