Thread: pgsql: Replace argument-checking Asserts with regular test-and-elog
pgsql: Replace argument-checking Asserts with regular test-and-elog
From
tgl@postgresql.org (Tom Lane)
Date:
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. Modified Files: -------------- pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic: ascii_and_mic.c (r1.15 -> r1.16) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c?r1=1.15&r2=1.16) pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic: cyrillic_and_mic.c (r1.18 -> r1.19) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c?r1=1.18&r2=1.19) pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic: euc_cn_and_mic.c (r1.18 -> r1.19) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c?r1=1.18&r2=1.19) pgsql/src/backend/utils/mb/conversion_procs/euc_jis_2004_and_shift_jis_2004: euc_jis_2004_and_shift_jis_2004.c (r1.5 -> r1.6) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_jis_2004_and_shift_jis_2004/euc_jis_2004_and_shift_jis_2004.c?r1=1.5&r2=1.6) pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis: euc_jp_and_sjis.c (r1.20 -> r1.21) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c?r1=1.20&r2=1.21) pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic: euc_kr_and_mic.c (r1.18 -> r1.19) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c?r1=1.18&r2=1.19) pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5: euc_tw_and_big5.c (r1.19 -> r1.20) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c?r1=1.19&r2=1.20) pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250: latin2_and_win1250.c (r1.16 -> r1.17) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c?r1=1.16&r2=1.17) pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic: latin_and_mic.c (r1.16 -> r1.17) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c?r1=1.16&r2=1.17) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii: utf8_and_ascii.c (r1.17 -> r1.18) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c?r1=1.17&r2=1.18) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5: utf8_and_big5.c (r1.19 -> r1.20) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c?r1=1.19&r2=1.20) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic: utf8_and_cyrillic.c (r1.22 -> r1.23) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c?r1=1.22&r2=1.23) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn: utf8_and_euc_cn.c (r1.20 -> r1.21) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c?r1=1.20&r2=1.21) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jis_2004: utf8_and_euc_jis_2004.c (r1.4 -> r1.5) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jis_2004/utf8_and_euc_jis_2004.c?r1=1.4&r2=1.5) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp: utf8_and_euc_jp.c (r1.20 -> r1.21) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c?r1=1.20&r2=1.21) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr: utf8_and_euc_kr.c (r1.20 -> r1.21) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c?r1=1.20&r2=1.21) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw: utf8_and_euc_tw.c (r1.20 -> r1.21) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c?r1=1.20&r2=1.21) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030: utf8_and_gb18030.c (r1.21 -> r1.22) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c?r1=1.21&r2=1.22) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk: utf8_and_gbk.c (r1.18 -> r1.19) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c?r1=1.18&r2=1.19) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859: utf8_and_iso8859.c (r1.29 -> r1.30) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c?r1=1.29&r2=1.30) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1: utf8_and_iso8859_1.c (r1.21 -> r1.22) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c?r1=1.21&r2=1.22) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab: utf8_and_johab.c (r1.20 -> r1.21) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c?r1=1.20&r2=1.21) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_shift_jis_2004: utf8_and_shift_jis_2004.c (r1.4 -> r1.5) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_shift_jis_2004/utf8_and_shift_jis_2004.c?r1=1.4&r2=1.5) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis: utf8_and_sjis.c (r1.18 -> r1.19) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c?r1=1.18&r2=1.19) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc: utf8_and_uhc.c (r1.18 -> r1.19) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c?r1=1.18&r2=1.19) pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win: utf8_and_win.c (r1.13 -> r1.14) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c?r1=1.13&r2=1.14) pgsql/src/backend/utils/mb: wchar.c (r1.68 -> r1.69) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/mb/wchar.c?r1=1.68&r2=1.69) pgsql/src/include/mb: pg_wchar.h (r1.82 -> r1.83) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/mb/pg_wchar.h?r1=1.82&r2=1.83)