Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] fix: don't request absent tuple field
@ 2019-11-13 18:20 Ilya Kosarev
  2019-11-14 10:39 ` Kirill Yukhin
  0 siblings, 1 reply; 2+ messages in thread
From: Ilya Kosarev @ 2019-11-13 18:20 UTC (permalink / raw)
  To: tarantool-patches

During replacement of tuple_field_bool_xc with it's non-xc version
turned out that it might be called even if there is not enough fields
in processed tuple. Now it is fixed.

Part of #4247
---
https://github.com/tarantool/tarantool/tree/i.kosarev/fix-tuple-field-request
https://github.com/tarantool/tarantool/issues/4247

 src/box/alter.cc | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/box/alter.cc b/src/box/alter.cc
index 32f84ded7..6741b7aa4 100644
--- a/src/box/alter.cc
+++ b/src/box/alter.cc
@@ -5265,12 +5265,13 @@ ck_constraint_def_new_from_tuple(struct tuple *tuple)
 	const char *expr_str =
 		tuple_field_str_xc(tuple, BOX_CK_CONSTRAINT_FIELD_CODE,
 				   &expr_str_len);
-	bool out;
-	if (tuple_field_bool(tuple, BOX_CK_CONSTRAINT_FIELD_IS_ENABLED,
-			     &out) != 0)
-		diag_raise();
-	bool is_enabled =
-		tuple_field_count(tuple) <= BOX_CK_CONSTRAINT_FIELD_IS_ENABLED || out;
+	bool is_enabled = true;
+	if (tuple_field_count(tuple) > BOX_CK_CONSTRAINT_FIELD_IS_ENABLED) {
+		if (tuple_field_bool(tuple,
+				     BOX_CK_CONSTRAINT_FIELD_IS_ENABLED,
+				     &is_enabled) != 0)
+			diag_raise();
+	}
 	struct ck_constraint_def *ck_def =
 		ck_constraint_def_new(name, name_len, expr_str, expr_str_len,
 				      space_id, language, is_enabled);
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Tarantool-patches] [PATCH] fix: don't request absent tuple field
  2019-11-13 18:20 [Tarantool-patches] [PATCH] fix: don't request absent tuple field Ilya Kosarev
@ 2019-11-14 10:39 ` Kirill Yukhin
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2019-11-14 10:39 UTC (permalink / raw)
  To: Ilya Kosarev; +Cc: tarantool-patches

Hello,

On 13 ноя 21:20, Ilya Kosarev wrote:
> During replacement of tuple_field_bool_xc with it's non-xc version
> turned out that it might be called even if there is not enough fields
> in processed tuple. Now it is fixed.
> 
> Part of #4247
> ---
> https://github.com/tarantool/tarantool/tree/i.kosarev/fix-tuple-field-request
> https://github.com/tarantool/tarantool/issues/4247

Checked into master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 18:20 [Tarantool-patches] [PATCH] fix: don't request absent tuple field Ilya Kosarev
2019-11-14 10:39 ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox