sql: properly check fieldno in sql.c
Tuples that have been inserted into system spaces after the _space definition has been inserted into _space have the same format as the space into which they were inserted. However, previously inserted tuples have an incomplete tuple format with parts missing. One piece that is missing information is the JSON token, which is used to determine the number of fields. The tarantoolsqlIdxKeyCompare() function contains the correct checks for the case when the number of fields from the format is equal to or less than the fieldno field, but uses tuple_format_field() before this check, resulting in an assertion. This patch forces tarantoolsqlIdxKeyCompare() to call tuple_format_field() only after checking that fieldno is less than field_count. Closes #8418 NO_DOC=Bugfix in debug.
Showing
- changelogs/unreleased/gh-8418-asserton-on-select-from-_space.md 4 additions, 0 deletions...logs/unreleased/gh-8418-asserton-on-select-from-_space.md
- src/box/sql.c 5 additions, 3 deletionssrc/box/sql.c
- test/sql-luatest/gh_8418_select_lead_to_assertion_test.lua 20 additions, 0 deletionstest/sql-luatest/gh_8418_select_lead_to_assertion_test.lua
Please register or sign in to comment