Skip site navigation (1) Skip section navigation (2)

pgsql: Replace argument-checking Asserts with regular test-and-elog

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Replace argument-checking Asserts with regular test-and-elog
Date: 2009-01-29 19:25:01
Message-ID: 20090129192501.AD4147559ED@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
Replace argument-checking Asserts with regular test-and-elog checks in all
encoding conversion functions.  These are not can't-happen cases because
it's possible to create a conversion with the wrong conversion function
for the specified encoding pair.  That would lead to an Assert crash in
an Assert-enabled build, or incorrect conversion otherwise, neither of
which is desirable.  This would be a DOS issue if production databases
were customarily built with asserts enabled, but fortunately that's not so.
Per an observation by Heikki.

Back-patch to all supported branches.

Tags:
----
REL8_0_STABLE

Modified Files:
--------------
    pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic:
        ascii_and_mic.c (r1.9 -> r1.9.4.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c?r1=1.9&r2=1.9.4.1)
    pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic:
        cyrillic_and_mic.c (r1.9.4.2 -> r1.9.4.3)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c?r1=1.9.4.2&r2=1.9.4.3)
    pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic:
        euc_cn_and_mic.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis:
        euc_jp_and_sjis.c (r1.9.4.4 -> r1.9.4.5)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c?r1=1.9.4.4&r2=1.9.4.5)
    pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic:
        euc_kr_and_mic.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5:
        euc_tw_and_big5.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250:
        latin2_and_win1250.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic:
        latin_and_mic.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii:
        utf8_and_ascii.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5:
        utf8_and_big5.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic:
        utf8_and_cyrillic.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn:
        utf8_and_euc_cn.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp:
        utf8_and_euc_jp.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr:
        utf8_and_euc_kr.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw:
        utf8_and_euc_tw.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030:
        utf8_and_gb18030.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk:
        utf8_and_gbk.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859:
        utf8_and_iso8859.c (r1.11.4.1 -> r1.11.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c?r1=1.11.4.1&r2=1.11.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1:
        utf8_and_iso8859_1.c (r1.10.4.1 -> r1.10.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c?r1=1.10.4.1&r2=1.10.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab:
        utf8_and_johab.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis:
        utf8_and_sjis.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc:
        utf8_and_uhc.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb:
        wchar.c (r1.40.4.5 -> r1.40.4.6)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/wchar.c?r1=1.40.4.5&r2=1.40.4.6)
    pgsql/src/include/mb:
        pg_wchar.h (r1.56.4.1 -> r1.56.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/mb/pg_wchar.h?r1=1.56.4.1&r2=1.56.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250:
        utf8_and_win1250.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256:
        utf8_and_win1256.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874:
        utf8_and_win874.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c?r1=1.9.4.1&r2=1.9.4.2)
    pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn:
        utf8_and_tcvn.c (r1.9.4.1 -> r1.9.4.2)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c?r1=1.9.4.1&r2=1.9.4.2)

pgsql-committers by date

Next:From: Tom LaneDate: 2009-01-29 19:25:15
Subject: pgsql: Replace argument-checking Asserts with regular test-and-elog
Previous:From: Tom LaneDate: 2009-01-29 19:24:37
Subject: pgsql: Replace argument-checking Asserts with regular test-and-elog

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group