Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icu_collation_attributes() crashes server with certain attribute combinations #10

Closed
noinkling opened this issue Oct 20, 2020 · 3 comments

Comments

@noinkling
Copy link

noinkling commented Oct 20, 2020

=# SELECT * FROM icu_collation_attributes('und-u-ks-level1-ka-shifted-kv-space');
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Same with:

  • und-u-ks-level1-kv-punct|symbol|currency
  • und-u-ka-shifted-kv-punct|symbol|currency
  • Probably other combinations?

They all work if I set the second argument (exclude_defaults) to true though.

These combinations work fine (although there isn't actually a kv row in the result, it changes what's in the parentheses of displayname instead):

  • und-u-ks-level1-kv-space
  • und-u-ka-shifted-kv-space
  • und-u-kv-punct|symbol|currency
  • ...And a whole bunch more.

Postgres 13 (x64), Windows 10, ICU 67.1 (extension compiled with MSVC). Haven't tested on Linux.

Relevant section from the server log:

[4968] LOG:  server process (PID 8840) was terminated by exception 0xC0000409
[4968] DETAIL:  Failed process was running: SELECT * FROM icu_collation_attributes('und-u-ks-level1-ka-shifted-kv-space');
[4968] HINT:  See C include file "ntstatus.h" for a description of the hexadecimal value.

I think it has something to do with the displayname - maybe a long description is too much for its allocated buffer or something?

@dverite
Copy link
Owner

dverite commented Oct 21, 2020

Thanks for the report. I don't reproduce it on linux, but I think that commit 6515081 unfortunately missed one of these uloc_getDisplay* calls, and as you suspect, the long displayname triggers an allocation bug. I'll commit a fix shortly.
The missing kv tag is normal, icu_ext doesn't know about kv yet. I'll look at adding this separately.

@dverite
Copy link
Owner

dverite commented Oct 23, 2020

I hope the bug is fixed by the just-pushed commit d6662df.

@noinkling
Copy link
Author

That fixes it 👍

@dverite dverite closed this as completed Nov 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants