From: Siavash Tavakoli Date: Mon, 27 Sep 2021 10:35:38 +0000 (+0100) Subject: driver-pgsql: Fix assert-crash when using binary fields X-Git-Tag: 2.3.18~316 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=103a99d53138b39081ad6451955a0fe7610b998c;p=thirdparty%2Fdovecot%2Fcore.git driver-pgsql: Fix assert-crash when using binary fields array_idx_modifiable() changed behavior in 1d4e5de8414ed93d1c810b30a91ad83d6d954861 and doesn't allocate space anymore. Fixes: Panic: file array.c: line 10 (array_idx_modifiable_i): assertion failed: (idx < array->buffer->used / array->element_size) --- diff --git a/src/lib-sql/driver-pgsql.c b/src/lib-sql/driver-pgsql.c index d04c20d831..d82c33754a 100644 --- a/src/lib-sql/driver-pgsql.c +++ b/src/lib-sql/driver-pgsql.c @@ -816,7 +816,7 @@ driver_pgsql_result_get_field_value_binary(struct sql_result *_result, if (!array_is_created(&result->binary_values)) i_array_init(&result->binary_values, idx + 1); - binary_value = array_idx_modifiable(&result->binary_values, idx); + binary_value = array_idx_get_space(&result->binary_values, idx); if (binary_value->value == NULL) { binary_value->value = PQunescapeBytea((const unsigned char *)value,