Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e971357

Browse filesBrowse files
committed
Fix handling of structure for bytea data type in ECPG
Some code paths dedicated to bytea used the structure for varchar. This did not lead to any actual bugs, as bytea and varchar have the same definition, but it could become a trap if one of these definitions changes for a new feature or a bug fix. Issue introduced by 050710b. Author: Shenhao Wang Reviewed-by: Vignesh C, Michael Paquier Discussion: https://postgr.es/m/07ac7dee1efc44f99d7f53a074420177@G08CNEXMBPEKD06.g08.fujitsu.local Backpatch-through: 12
1 parent 200f610 commit e971357
Copy full SHA for e971357

File tree

Expand file treeCollapse file tree

3 files changed

+7
-7
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+7
-7
lines changed

‎src/interfaces/ecpg/ecpglib/data.c

Copy file name to clipboardExpand all lines: src/interfaces/ecpg/ecpglib/data.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ ecpg_get_data(const PGresult *results, int act_tuple, int act_field, int lineno,
523523

524524
case ECPGt_bytea:
525525
{
526-
struct ECPGgeneric_varchar *variable =
527-
(struct ECPGgeneric_varchar *) (var + offset * act_tuple);
526+
struct ECPGgeneric_bytea *variable =
527+
(struct ECPGgeneric_bytea *) (var + offset * act_tuple);
528528
long dst_size,
529529
src_size,
530530
dec_size;

‎src/interfaces/ecpg/ecpglib/descriptor.c

Copy file name to clipboardExpand all lines: src/interfaces/ecpg/ecpglib/descriptor.c
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,8 +591,8 @@ set_desc_attr(struct descriptor_item *desc_item, struct variable *var,
591591

592592
else
593593
{
594-
struct ECPGgeneric_varchar *variable =
595-
(struct ECPGgeneric_varchar *) (var->value);
594+
struct ECPGgeneric_bytea *variable =
595+
(struct ECPGgeneric_bytea *) (var->value);
596596

597597
desc_item->is_binary = true;
598598
desc_item->data_len = variable->len;

‎src/interfaces/ecpg/ecpglib/execute.c

Copy file name to clipboardExpand all lines: src/interfaces/ecpg/ecpglib/execute.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,8 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
822822

823823
case ECPGt_bytea:
824824
{
825-
struct ECPGgeneric_varchar *variable =
826-
(struct ECPGgeneric_varchar *) (var->value);
825+
struct ECPGgeneric_bytea *variable =
826+
(struct ECPGgeneric_bytea *) (var->value);
827827

828828
if (!(mallocedval = (char *) ecpg_alloc(variable->len, lineno)))
829829
return false;
@@ -1401,7 +1401,7 @@ ecpg_build_params(struct statement *stmt)
14011401

14021402
if (var->type == ECPGt_bytea)
14031403
{
1404-
binary_length = ((struct ECPGgeneric_varchar *) (var->value))->len;
1404+
binary_length = ((struct ECPGgeneric_bytea *) (var->value))->len;
14051405
binary_format = true;
14061406
}
14071407
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.