Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd5b9c2b

Browse files
committed
Disallow null category in crosstab_hash
While building a hash map of categories in load_categories_hash,resulting category names have not thus far been checked to ensurethey are not null. Prior to pg12 null category names worked to theextent that they did not crash on some platforms. This is becausethose system libraries have an snprintf which can deal with beingpassed a null pointer argument for a string. But even in those casesnull categories did nothing useful. And on some platforms it crashed.As of pg12, our own version of snprintf gets called, and it doesnot deal with null pointer arguments at all, and crashes consistently.Fix that by disallowing null categories. They never worked usefully,and no one has ever asked for them to work previously. Back-patch toall supported branches.Reported-By: Ireneusz PlutaDiscussion:https://postgr.es/m/16176-7489719b05e4303c@postgresql.org
1 parent39ebb94 commitd5b9c2b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎contrib/tablefunc/tablefunc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,11 @@ load_categories_hash(char *cats_sql, MemoryContext per_query_ctx)
762762

763763
/* get the category from the current sql result tuple */
764764
catname=SPI_getvalue(spi_tuple,spi_tupdesc,1);
765+
if (catname==NULL)
766+
ereport(ERROR,
767+
(errcode(ERRCODE_SYNTAX_ERROR),
768+
errmsg("provided \"categories\" SQL must " \
769+
"not return NULL values")));
765770

766771
SPIcontext=MemoryContextSwitchTo(per_query_ctx);
767772

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp