From b273a1e9a1cb3347dbe0b9260a3e6b3674e5851b Mon Sep 17 00:00:00 2001 From: Jehan-Guillaume de Rorthais Date: Mon, 29 Jun 2020 16:48:25 +0200 Subject: [PATCH 2/2] Fix ecpg crash with bytea and cursor variables Author: Jehan-Guillaume de Rorthais Reported-by: to-be-defined --- src/interfaces/ecpg/preproc/ecpg.header | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 4091ffd28b..f37112dd4d 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -289,7 +289,8 @@ adjust_outofscope_cursor_vars(struct cursor *cur) else if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char - && ptr->variable->type->type != ECPGt_string) + && ptr->variable->type->type != ECPGt_string + && ptr->variable->type->type != ECPGt_bytea) && atoi(ptr->variable->type->size) > 1) { newvar = new_variable(cat_str(4, mm_strdup("("), @@ -305,7 +306,8 @@ adjust_outofscope_cursor_vars(struct cursor *cur) else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char - || ptr->variable->type->type == ECPGt_string) + || ptr->variable->type->type == ECPGt_string + || ptr->variable->type->type == ECPGt_bytea) && atoi(ptr->variable->type->size) > 1) { newvar = new_variable(cat_str(4, mm_strdup("("), @@ -316,7 +318,8 @@ adjust_outofscope_cursor_vars(struct cursor *cur) ptr->variable->type->size, ptr->variable->type->counter), 0); - if (ptr->variable->type->type == ECPGt_varchar) + if (ptr->variable->type->type == ECPGt_varchar || + ptr->variable->type->type == ECPGt_bytea) var_ptr = true; } else if (ptr->variable->type->type == ECPGt_struct -- 2.20.1