- Description:
- [Mirror] Middleware for data
- Last Change:
- Clone URL:
Commit Briefs
test/fuzz: fix errors "table index is {nil, NaN}" (ligurio/fix-lua-errors)
Running of automatically generated Lua programs sometimes failed due to errors "table index is nil" and "table index is NaN" (3%). The error was caused by `nil` and `NaN` values used as a table indices and key values, but it is prohibited. Examples of errors are the following: ``` local t = {} t[nil] = 42 -- table index is nil. t[0 / 0] = 42 -- table index is NaN. local a = { [nil] = 0 } -- table index is nil. local a = { [0 / 0] = 0 } -- table index is NaN. ``` The patch fixes serializer, index or key value is always not a `nil` and not a `NaN`: it is either a generated value or a default number. NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix errors "'<name>' expected near 'and'"
Running of automatically generated Lua programs sometimes failed with an error "'<name>' expected near 'and'" (0.07%). Example of the error is the following: ```lua local t = {} t.or = 0 -- "'<name>' expected near 'or'" t.nil = 0 -- "'<name>' expected near 'nil'" t.not = 0 -- "'<name>' expected near 'not'" ``` This error was caused by reserved Lua keywords used as table indices. The patch fixes serializer, if the automatically generated index name is equal to the reserved keyword then postfix "_1" is added to index name. NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix errors "attempt to compare"
Running of automatically generated Lua programs sometimes failed with an error "attempt to compare" (5%). The error is caused by comparison of non-comparable Lua values: string and boolean, number and function, boolean and number etc. In Lua 5.1 and LuaJIT 2.1 (which follow the semantics and behaviour of Lua 5.1), it is not possible to overload Lua metamethods __le and __lt for these base types. Therefore, an approach with metamethods doesn't help there. See an LuaJIT implementation in `src/lj_meta.c:lj_meta_comp()` and result of comparison values with different types and metamethods `__le` and `__lt`: ``` $ cat compare.lua local mt_table = {} mt_table.__le = function() assert() end mt_table.__lt = function() assert() end local res local str = 'str1' debug.setmetatable(str, mt_table) -- __le res = str <= 10 -- __lt res = str < 10 $ luajit compare.lua luajit: compare.lua:10: attempt to compare string with number stack traceback: compare.lua:10: in main chunk [C]: at 0x55908425f2e0 $ lua5.1 compare.lua lua5.1: compare.lua:10: attempt to compare string with number stack traceback: compare.lua:10: in main chunk [C]: ? $ lua5.2 compare.lua lua5.2: compare.lua:2: assertion failed! stack traceback: [C]: in function 'assert' compare.lua:2: in function '__le' compare.lua:10: in main chunk [C]: in ? $ ``` To fix errors triggered by comparison of non-comparable values introduced a metamethods `__le` and `__lt` and comparison operators are wrapped by a Lua function `only_numbers_cmp` that is implemented in `preamble.lua`. The function perform comparison only when both values have type 'number', otherwise it returns `false`. NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix a group of errors related to `for`
Running of automatically generated Lua programs sometimes failed with an errors like: - "'for' initial value must be a" (12%) - "'for' limit must be a" (4.5%) - "'for' step must be a" (0.4%) The patch fixes these errors. NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix errors "ambiguous syntax"
Running of automatically generated Lua programs sometimes failed with an error like "ambiguous syntax (function call x new statement)" (0.3%). The patch fixes these errors. NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix errors due to commented out code
Running of automatically generated Lua programs sometimes failed with an errors like: - "unexpected symbol near" (0.3%) - "bad argument" (0.2%) - "'then' expected near" (0.02%) NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix a group of semantic errors
Running of automatically generated Lua programs sometimes failed due to semantic errors like: - "attempt to index" (16%) - "attempt to perform arithmetic on" (12%) - "attempt to call" (11%) - "attempt to concatenate" (3%) - "attempt to get length of" (1%) Example of an error "attempt to index" is the following: ``` Name0 = 'Name'; function Name0:Name4() end ``` These errors are happened because Lua objects have no appropriate metamethods and therefore these operations are not applicable: - "attempt to index": missed `__index` metamethod - "attempt to call": missed `__call` metamethod - "attempt to perform arithmetic on": missed metamethods that implements arithmetic operations - "attempt to get length of": missed `__len` metamethod - "attempt to concatenate": missed `__concat` metamethod The patch defines a Lua metatables [1] and set this metatables to a Lua values. 1. https://www.lua.org/manual/5.1/manual.html#2.8 NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
test/fuzz: fix "cannot use '...' outside a vararg function"
Parsing of automatically generated Lua programs sometimes failed with an error "cannot use '...' outside a vararg function near '...'". These errors breaks about 1.4% of generated programs. Example is the following: ```lua counter_0 = 0 counter_1 = 0 Name0:Name0 { }; repeat if counter_0 > 5 then break end counter_0 = counter_0 + 1 until function () if counter_1 > 5 then return end counter_1 = counter_1 + 1 return ..., 'Name' end ``` Vararg expressions, denoted by three dots ('...'), can only be used when directly inside a vararg functions, see Lua 5.1 Reference Manual, 2.5.9 – Function Definitions [1]. The patch fixes serializer, now ellipsis is used when function has variable number of arguments. 1. https://www.lua.org/manual/5.1/manual.html#2.5.9 NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
cmake: fix protobuf library name
Protocol Buffers library has a name `protobufd` when CMAKE_BUILD_TYPE is equal to "Debug". In other cases the name is `protobuf`. The patch fixes the library name. Follows up commit b11072a66d45 ("cmake: add dependencies for LuaJIT and SQL fuzzers"). Follows up #4823 NO_CHANGELOG=build NO_DOC=build NO_TEST=build
Add @ligurio as codeowner for fuzzing tests
I want to receive review request notifications about the changes and let people know who is responsible to accept them. NO_CHANGELOG=no code changes NO_TEST=no code changes NO_DOC=no code changes
Branches
Tree
README.md
# Tarantool [![Actions Status][actions-badge]][actions-url] [![Code Coverage][coverage-badge]][coverage-url] [![OSS Fuzz][oss-fuzz-badge]][oss-fuzz-url] [![Telegram][telegram-badge]][telegram-url] [![GitHub Discussions][discussions-badge]][discussions-url] [![Stack Overflow][stackoverflow-badge]][stackoverflow-url] [Tarantool][tarantool-url] is an in-memory computing platform consisting of a database and an application server. It is distributed under [BSD 2-Clause][license] terms. Key features of the application server: * Heavily optimized Lua interpreter with incredibly fast tracing JIT compiler, based on LuaJIT 2.1. * Cooperative multitasking, non-blocking IO. * [Persistent queues][queue]. * [Sharding][vshard]. * [Cluster and application management framework][cartridge]. * Access to external databases such as [MySQL][mysql] and [PostgreSQL][pg]. * A rich set of built-in and standalone [modules][modules]. Key features of the database: * MessagePack data format and MessagePack based client-server protocol. * Two data engines: 100% in-memory with complete WAL-based persistence and an own implementation of LSM-tree, to use with large data sets. * Multiple index types: HASH, TREE, RTREE, BITSET. * Document oriented JSON path indexes. * Asynchronous master-master replication. * Synchronous quorum-based replication. * RAFT-based automatic leader election for the single-leader configuration. * Authentication and access control. * ANSI SQL, including views, joins, referential and check constraints. * [Connectors][connectors] for many programming languages. * The database is a C extension of the application server and can be turned off. Supported platforms are Linux (x86_64, aarch64), Mac OS X (x86_64, M1), FreeBSD (x86_64). Tarantool is ideal for data-enriched components of scalable Web architecture: queue servers, caches, stateful Web applications. To download and install Tarantool as a binary package for your OS or using Docker, please see the [download instructions][download]. To build Tarantool from source, see detailed [instructions][building] in the Tarantool documentation. To find modules, connectors and tools for Tarantool, check out our [Awesome Tarantool][awesome-list] list. Please report bugs to our [issue tracker][issue-tracker]. We also warmly welcome your feedback on the [discussions][discussions-url] page and questions on [Stack Overflow][stackoverflow-url]. We accept contributions via pull requests. Check out our [contributing guide][contributing]. Thank you for your interest in Tarantool! [actions-badge]: https://github.com/tarantool/tarantool/workflows/release/badge.svg [actions-url]: https://github.com/tarantool/tarantool/actions [coverage-badge]: https://coveralls.io/repos/github/tarantool/tarantool/badge.svg?branch=master [coverage-url]: https://coveralls.io/github/tarantool/tarantool?branch=master [telegram-badge]: https://img.shields.io/badge/Telegram-join%20chat-blue.svg [telegram-url]: http://telegram.me/tarantool [discussions-badge]: https://img.shields.io/github/discussions/tarantool/tarantool [discussions-url]: https://github.com/tarantool/tarantool/discussions [stackoverflow-badge]: https://img.shields.io/badge/stackoverflow-tarantool-orange.svg [stackoverflow-url]: https://stackoverflow.com/questions/tagged/tarantool [oss-fuzz-badge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/tarantool.svg [oss-fuzz-url]: https://oss-fuzz.com/coverage-report/job/libfuzzer_asan_tarantool/latest [tarantool-url]: https://www.tarantool.io/en/ [license]: LICENSE [modules]: https://www.tarantool.io/en/download/rocks [queue]: https://github.com/tarantool/queue [vshard]: https://github.com/tarantool/vshard [cartridge]: https://github.com/tarantool/cartridge [mysql]: https://github.com/tarantool/mysql [pg]: https://github.com/tarantool/pg [connectors]: https://www.tarantool.io/en/download/connectors [download]: https://www.tarantool.io/en/download/ [building]: https://www.tarantool.io/en/doc/latest/dev_guide/building_from_source/ [issue-tracker]: https://github.com/tarantool/tarantool/issues [contributing]: CONTRIBUTING.md [awesome-list]: https://github.com/tarantool/awesome-tarantool/