[tarantool-patches] [PATCH] sql: initialize variable containing opcode

Nikita Pettik korablev at tarantool.org
Fri Oct 5 00:17:58 MSK 2018


This bug appeared after patch on eliminating cursor usage for write
operations in SQL (commit: 6fc3efec7). Lack of this initialization led
to missed generation of cursor opening and as a consequence - usage of
broken cursor during VDBE execution.

Closes #3719
---
https://github.com/tarantool/tarantool/tree/np/gh-3719-fix-uninitialized-var
https://github.com/tarantool/tarantool/issues/3719

 src/box/sql/where.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index 6a1bea091..520a847dd 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -4591,7 +4591,7 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 		if (pLoop->wsFlags & WHERE_INDEXED) {
 			struct index_def *idx_def = pLoop->index_def;
 			int iIndexCur;
-			int op;
+			int op = OP_IteratorOpen;
 			/* Check if index is primary. Either of
 			 * points should be true:
 			 * 1. struct Index is non-NULL and is
@@ -4636,7 +4636,6 @@ sqlite3WhereBegin(Parse * pParse,	/* The parser context */
 					}
 				}
 				assert(wctrlFlags & WHERE_ONEPASS_DESIRED);
-				op = OP_IteratorOpen;
 				pWInfo->aiCurOnePass[1] = iIndexCur;
 			} else if (iAuxArg
 				   && (wctrlFlags & WHERE_OR_SUBCLAUSE) != 0) {
-- 
2.15.1





More information about the Tarantool-patches mailing list