pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
6+ messages / 1 participants
[nested] [flat]

* pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
@ 2023-04-18 02:21 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-04-18 02:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where
it would incorrectly store the null terminator byte to str[-1] when
varcharsize is 0, which is something that can happen when using SQLDA.
This would eat 1 byte from the previous field stored, corrupting the
results generated.

All the callers of ecpg_get_data() estimate and allocate enough storage
for the data received, and the fix of this commit relies on this
assumption.  Note that this maps to the case where no padding or
truncation is required.

This issue has been introduced by 3b7ab43 with the Oracle compatibility
option, so backpatch down to v11.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f18029084784ec71a2e825cfcfd81b06d597ab93

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c                 |  19 +-
.../ecpg/test/compat_oracle/char_array.pgc         |  31 ++-
.../ecpg/test/expected/compat_oracle-char_array.c  | 216 +++++++++++++++------
.../test/expected/compat_oracle-char_array.stderr  | 166 +++++++++-------
.../test/expected/compat_oracle-char_array.stdout  |   5 +
5 files changed, 310 insertions(+), 127 deletions(-)



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

* pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
@ 2023-04-18 02:21 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-04-18 02:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where
it would incorrectly store the null terminator byte to str[-1] when
varcharsize is 0, which is something that can happen when using SQLDA.
This would eat 1 byte from the previous field stored, corrupting the
results generated.

All the callers of ecpg_get_data() estimate and allocate enough storage
for the data received, and the fix of this commit relies on this
assumption.  Note that this maps to the case where no padding or
truncation is required.

This issue has been introduced by 3b7ab43 with the Oracle compatibility
option, so backpatch down to v11.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8c746be44002e8f95dcf8e98f58a47ac851563ee

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c                 |  19 +-
.../ecpg/test/compat_oracle/char_array.pgc         |  31 ++-
.../ecpg/test/expected/compat_oracle-char_array.c  | 216 +++++++++++++++------
.../test/expected/compat_oracle-char_array.stderr  | 166 +++++++++-------
.../test/expected/compat_oracle-char_array.stdout  |   5 +
5 files changed, 310 insertions(+), 127 deletions(-)



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

* pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
@ 2023-04-18 02:21 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-04-18 02:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where
it would incorrectly store the null terminator byte to str[-1] when
varcharsize is 0, which is something that can happen when using SQLDA.
This would eat 1 byte from the previous field stored, corrupting the
results generated.

All the callers of ecpg_get_data() estimate and allocate enough storage
for the data received, and the fix of this commit relies on this
assumption.  Note that this maps to the case where no padding or
truncation is required.

This issue has been introduced by 3b7ab43 with the Oracle compatibility
option, so backpatch down to v11.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/02f0764546a9ce7f3d843e049bdfa790afa1cf4a

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c                 |  19 +-
.../ecpg/test/compat_oracle/char_array.pgc         |  31 ++-
.../ecpg/test/expected/compat_oracle-char_array.c  | 216 +++++++++++++++------
.../test/expected/compat_oracle-char_array.stderr  | 166 +++++++++-------
.../test/expected/compat_oracle-char_array.stdout  |   5 +
5 files changed, 310 insertions(+), 127 deletions(-)



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

* pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
@ 2023-04-18 02:21 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-04-18 02:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where
it would incorrectly store the null terminator byte to str[-1] when
varcharsize is 0, which is something that can happen when using SQLDA.
This would eat 1 byte from the previous field stored, corrupting the
results generated.

All the callers of ecpg_get_data() estimate and allocate enough storage
for the data received, and the fix of this commit relies on this
assumption.  Note that this maps to the case where no padding or
truncation is required.

This issue has been introduced by 3b7ab43 with the Oracle compatibility
option, so backpatch down to v11.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e9e457d22d264308bd709ac034b23a6c5716432a

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c                 |  19 +-
.../ecpg/test/compat_oracle/char_array.pgc         |  31 ++-
.../ecpg/test/expected/compat_oracle-char_array.c  | 216 +++++++++++++++------
.../test/expected/compat_oracle-char_array.stderr  | 166 +++++++++-------
.../test/expected/compat_oracle-char_array.stdout  |   5 +
5 files changed, 310 insertions(+), 127 deletions(-)



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

* pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
@ 2023-04-18 02:21 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-04-18 02:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where
it would incorrectly store the null terminator byte to str[-1] when
varcharsize is 0, which is something that can happen when using SQLDA.
This would eat 1 byte from the previous field stored, corrupting the
results generated.

All the callers of ecpg_get_data() estimate and allocate enough storage
for the data received, and the fix of this commit relies on this
assumption.  Note that this maps to the case where no padding or
truncation is required.

This issue has been introduced by 3b7ab43 with the Oracle compatibility
option, so backpatch down to v11.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a28bd77136db486b081ef392c423c89a392b3aa0

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c                 |  19 +-
.../ecpg/test/compat_oracle/char_array.pgc         |  31 ++-
.../ecpg/test/expected/compat_oracle-char_array.c  | 216 +++++++++++++++------
.../test/expected/compat_oracle-char_array.stderr  | 166 +++++++++-------
.../test/expected/compat_oracle-char_array.stdout  |   5 +
5 files changed, 310 insertions(+), 127 deletions(-)



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

* pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA
@ 2023-04-18 02:21 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-04-18 02:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

ecpg: Fix handling of strings in ORACLE compat code with SQLDA

When compiled with -C ORACLE, ecpg_get_data() had a one-off issue where
it would incorrectly store the null terminator byte to str[-1] when
varcharsize is 0, which is something that can happen when using SQLDA.
This would eat 1 byte from the previous field stored, corrupting the
results generated.

All the callers of ecpg_get_data() estimate and allocate enough storage
for the data received, and the fix of this commit relies on this
assumption.  Note that this maps to the case where no padding or
truncation is required.

This issue has been introduced by 3b7ab43 with the Oracle compatibility
option, so backpatch down to v11.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20230410.173500.440060475837236886.horikyota.ntt@gmail.com
Backpatch-through: 11

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9eb44bb043af924d9fe567145a3c6510d584399b

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c                 |  19 +-
.../ecpg/test/compat_oracle/char_array.pgc         |  31 ++-
.../ecpg/test/expected/compat_oracle-char_array.c  | 216 +++++++++++++++------
.../test/expected/compat_oracle-char_array.stderr  | 166 +++++++++-------
.../test/expected/compat_oracle-char_array.stdout  |   5 +
5 files changed, 310 insertions(+), 127 deletions(-)



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


end of thread, other threads:[~2023-04-18 02:21 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-04-18 02:21 pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA Michael Paquier <michael@paquier.xyz>
2023-04-18 02:21 pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA Michael Paquier <michael@paquier.xyz>
2023-04-18 02:21 pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA Michael Paquier <michael@paquier.xyz>
2023-04-18 02:21 pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA Michael Paquier <michael@paquier.xyz>
2023-04-18 02:21 pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA Michael Paquier <michael@paquier.xyz>
2023-04-18 02:21 pgsql: ecpg: Fix handling of strings in ORACLE compat code with SQLDA Michael Paquier <michael@paquier.xyz>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox