From 1d7bd07ba834003ea2dd6855aa0fd9a3c973d7a8 Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenkov <36882414+akuzm@users.noreply.github.com> Date: Wed, 22 May 2024 15:28:26 +0200 Subject: [PATCH] Use the proper error code for corrupt compressed array (#6943) Currently we use elog() which has a wrong error code XX000. --- tsl/src/compression/array.c | 3 +-- tsl/test/expected/compression_algos.out | 4 ++-- .../ede4129ca9c4d8dbd649aa6f2d5c0038e1537716 | Bin 0 -> 32 bytes .../ef519c31ea5d415293021b0ca83dd655701d2c13 | Bin 0 -> 32843 bytes 4 files changed, 3 insertions(+), 4 deletions(-) create mode 100644 tsl/test/fuzzing/compression/array-text/ede4129ca9c4d8dbd649aa6f2d5c0038e1537716 create mode 100644 tsl/test/fuzzing/compression/array-text/ef519c31ea5d415293021b0ca83dd655701d2c13 diff --git a/tsl/src/compression/array.c b/tsl/src/compression/array.c index 3c658382abd..a10c4d6dc9f 100644 --- a/tsl/src/compression/array.c +++ b/tsl/src/compression/array.c @@ -368,8 +368,7 @@ tsl_array_decompression_iterator_from_datum_forward(Datum compressed_array, Oid Assert(compressed_array_header->compression_algorithm == COMPRESSION_ALGORITHM_ARRAY); - if (element_type != compressed_array_header->element_type) - elog(ERROR, "trying to decompress the wrong type"); + CheckCompressedData(element_type == compressed_array_header->element_type); return array_decompression_iterator_alloc_forward(&si, compressed_array_header->element_type, diff --git a/tsl/test/expected/compression_algos.out b/tsl/test/expected/compression_algos.out index bf50a924680..60eafcab4ed 100644 --- a/tsl/test/expected/compression_algos.out +++ b/tsl/test/expected/compression_algos.out @@ -1596,8 +1596,8 @@ group by 2, 3 order by 1 desc count | bulk_result | rowbyrow_result -------+-------------+----------------- 18 | true | true - 14 | XX001 | XX001 - 7 | 08P01 | 08P01 + 15 | XX001 | XX001 + 8 | 08P01 | 08P01 2 | 3F000 | 3F000 1 | 22021 | 22021 1 | false | false diff --git a/tsl/test/fuzzing/compression/array-text/ede4129ca9c4d8dbd649aa6f2d5c0038e1537716 b/tsl/test/fuzzing/compression/array-text/ede4129ca9c4d8dbd649aa6f2d5c0038e1537716 new file mode 100644 index 0000000000000000000000000000000000000000..557bbf84a6facdd08499fe78ed19f3adca07498d GIT binary patch literal 32 jcmZQ%EJ%+}PAo~x$xmk}Nv$YhU|?imU}gY=&`@Roh`R=g literal 0 HcmV?d00001 diff --git a/tsl/test/fuzzing/compression/array-text/ef519c31ea5d415293021b0ca83dd655701d2c13 b/tsl/test/fuzzing/compression/array-text/ef519c31ea5d415293021b0ca83dd655701d2c13 new file mode 100644 index 0000000000000000000000000000000000000000..a0e01c69a390a710a34407d8b7b93fb11f7b8c23 GIT binary patch literal 32843 zcmeI)J&VFX5CG5!R#ypj)>_=J5)sK2f)**Ryq_-GNKivg_QTCSixf%R$-I$avkA_c zbGzN|y4~^AHr?U3Yp$Qa+t!A_kidNCpko9GTm@E34vzww$D@fo1PBlyP_uyfLe15e zI{^a01T@oNlm;U3@d96QuFz^l99N?fATVJ8jdQ}qm0BnPw<)0{jgv}Xohpzx1PT=B zPklB8X5f+u5FkK+KmY+ZIROw2L4W`O&D3vzKs^E;Y}Zq3nGzsCfIwaWbL_nSq7z6d zV2+(qTPy+u2)q{Pzd`Z(JVyu+AW)xx4q0E#W&Cde3pvloG>>O0_7NaZnt%>pTE$#1 zf%gS0)xU4&n*<0D7$cz1j!|+B0RjZ#3s|#@Z!ALb0+xe{FJW~FtgFjd!UV<(^rt@l zPiMTGGYJqNKwwe=ZgM77PRS4;kV`-_%_T1`f%F2A9&D#iL_`9a1iqV}#Xa-|bqER@ literal 0 HcmV?d00001