Skip to content

Commit

Permalink
Merge branch 'fix/composites-check' into 'develop'
Browse files Browse the repository at this point in the history
Fix composites substitution after indexes removal #1830

See merge request itv-backend/reindexer!1671
  • Loading branch information
reindexer-bot committed Sep 4, 2024
1 parent f058ec1 commit a404aff
Show file tree
Hide file tree
Showing 59 changed files with 1,170 additions and 1,094 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.10..3.13)

project(reindexer)
cmake_minimum_required(VERSION 3.10)

enable_testing()
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Version 3.28.1 (XX.09.2024)
## Core
- [fix] Fixed pagination for `MERGE` fulltext queries. Previously those queries could return duplicates on different pages due to missing ordering guarantees
- [fix] Fixed fields filters serialization for `DISTINCT` aggregations (affects SQL logging only)
- [fix] Temporary disabled default values logic for indexed field from v3.27.0 - this logic may cause stability issues and will be reworked in further releases
- [fix] Add extra check for composites indexes substitution
- [fix] Fix composites substitution after indexes update

## Reindexer tool
- [fix] Fixed crash in `\quit`-command after previous errors
- [fix] Fixed crash in `git bash` on `Windows` platforms

## Face
- [fix] Fixed XSS vulnerability in table view

# Version 3.28.0 (16.08.2024)
## Core
- [fea] Updated [logging library](https://github.com/gabime/spdlog) to v1.14.1 and [formatting library](https://github.com/fmtlib/fmt) to v11.0.2
Expand Down
20 changes: 17 additions & 3 deletions cjson/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ func (dec *Decoder) decodeSlice(pl *payloadIface, rdser *Serializer, v *reflect.
var ptr unsafe.Pointer

k := v.Kind()

offset := 0
switch k {
case reflect.Slice:
Expand All @@ -331,7 +332,11 @@ func (dec *Decoder) decodeSlice(pl *payloadIface, rdser *Serializer, v *reflect.
// offset is 0
// No concatenation for the fixed size arrays
default:
panic(fmt.Errorf("can not convert '%s' to 'array'", v.Type().Kind().String()))
if count == 0 { // Allows empty slice for any scalar type (using default value)
return
} else {
panic(fmt.Errorf("can not convert '%s' to 'array'", v.Type().Kind().String()))
}
}

if subtag != TAG_OBJECT {
Expand Down Expand Up @@ -583,6 +588,7 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
ctagName := ctag.Name()

k := v.Kind()
initialV := v
if k == reflect.Ptr {
if v.IsNil() {
v.Set(reflect.New(v.Type().Elem()))
Expand Down Expand Up @@ -641,6 +647,7 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
} else {
panic(fmt.Errorf("err: intf=%s, name='%s' %s", v.Type().Name(), dec.state.tagsMatcher.tag2name(ctagName), ctag.Dump()))
}
initialV = v
k = v.Kind()
if k == reflect.Ptr {
if v.IsNil() {
Expand All @@ -659,8 +666,12 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
switch ctagType {
case TAG_ARRAY:
count := int(rdser.GetVarUInt())
pl.getArray(int(ctagField), *cnt, count, v)
*cnt += count
if k == reflect.Slice || k == reflect.Array || count != 0 { // Allows empty slice for any scalar type (using default value)
pl.getArray(int(ctagField), *cnt, count, v)
*cnt += count
} else {
initialV.Set(reflect.Zero(initialV.Type())) // Set nil to scalar pointers, intialized with empty arrays
}
default:
pl.getValue(int(ctagField), *cnt, v)
(*cnt)++
Expand All @@ -670,6 +681,9 @@ func (dec *Decoder) decodeValue(pl *payloadIface, rdser *Serializer, v reflect.V
switch ctagType {
case TAG_ARRAY:
dec.decodeSlice(pl, rdser, &v, fieldsoutcnt, cctagsPath)
if v.Kind() != reflect.Array && v.Kind() != reflect.Slice && v.Kind() != reflect.Interface {
initialV.Set(reflect.Zero(initialV.Type())) // Set nil to scalar pointers, intialized with empty arrays
}
case TAG_OBJECT:
for dec.decodeValue(pl, rdser, v, fieldsoutcnt, cctagsPath) {
}
Expand Down
31 changes: 0 additions & 31 deletions clang-tidy/.clang-tidy

This file was deleted.

10 changes: 0 additions & 10 deletions clang-tidy/.clang-tidy-ignore

This file was deleted.

Loading

0 comments on commit a404aff

Please sign in to comment.