pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Ensure maxlen is at leat 1 in dict_int
7+ messages / 1 participants
[nested] [flat]

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:40  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:40 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
master

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

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:41  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:41 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
REL_12_STABLE

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

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:41  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:41 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/267eb954cc96210985426aa31142ead37bfdc62c

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:42  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/46ce37b67a5144458adb0789eb4e9169a61881fd

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:42  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:42 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_6_STABLE

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

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:43  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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

* pgsql: Ensure maxlen is at leat 1 in dict_int
@ 2019-12-03 17:43  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Tomas Vondra @ 2019-12-03 17:43 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ensure maxlen is at leat 1 in dict_int

The dict_int text search dictionary template accepts maxlen parameter,
which is then used to cap the length of input strings. The value was
not properly checked, and the code simply does

    txt[d->maxlen] = '\0';

to insert a terminator, leading to segfaults with negative values.

This commit simply rejects values less than 1. The issue was there since
dct_int was introduced in 9.3, so backpatch all the way back to 9.4
which is the oldest supported version.

Reported-by: cili
Discussion: https://postgr.es/m/16144-a36a5bef7657047d@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/44381b1aff0e92acc91381c40f1b07514e93a18b

Modified Files
--------------
contrib/dict_int/dict_int.c            | 5 +++++
contrib/dict_int/expected/dict_int.out | 2 ++
contrib/dict_int/sql/dict_int.sql      | 2 ++
3 files changed, 9 insertions(+)



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


end of thread, other threads:[~2019-12-03 17:43 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 17:40 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>
2019-12-03 17:41 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>
2019-12-03 17:41 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>
2019-12-03 17:42 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>
2019-12-03 17:42 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>
2019-12-03 17:43 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>
2019-12-03 17:43 pgsql: Ensure maxlen is at leat 1 in dict_int Tomas Vondra <tomas.vondra@postgresql.org>

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