BUG #15420: Server crash. Segmentation fault when parsing xml file - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15420: Server crash. Segmentation fault when parsing xml file
Date
Msg-id 15420-6648d2ed070c05d4@postgresql.org
Whole thread Raw
Responses Re: BUG #15420: Server crash. Segmentation fault when parsing xmlfile
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15420
Logged by:          Sergey Mirvoda
Email address:      sergey@mirvoda.com
PostgreSQL version: 10.5
Operating system:   Ubuntu 16.04.3 LTS
Description:

Tested on
9.6.2 (Windows server 2012 r2), 10.5 (Ubuntu 16.04.3 LTS), 12devel
(Ubuntu)
9.4.1  (Windows server 2012 r2) works fine.

Steps to reproduce
1. Place this file into PG_DATA directory
https://www.dropbox.com/s/upteflaye9r3fz7/EGRUL_FULL_2018-01-01_X.XML?dl=1

2. Run this query in psql 
select d::xml from
convert_from(pg_read_binary_file('EGRUL_FULL_2018-01-01_X.XML'),'windows-1251')
g(d);

3. Notice connection crashed without restoring
4. Error log 
Sergey Mirvoda, [04.10.18 12:24]
2018-10-04 07:23:39.946 UTC [17114] LOG:  server process (PID 26155) was
terminated by signal 11: Segmentation fault
2018-10-04 07:23:39.946 UTC [17114] DETAIL:  Failed process was running:
select d::xml from
convert_from(pg_read_binary_file('egrul/EGRUL_FULL_2018-01-01_X.XML'),'windows-1251')
g(d);
2018-10-04 07:23:39.946 UTC [17114] LOG:  terminating any other active
server processes
2018-10-04 07:23:39.946 UTC [26143] WARNING:  terminating connection because
of crash of another server process
2018-10-04 07:23:39.946 UTC [26143] DETAIL:  The postmaster has commanded
this server process to roll back the current transaction and exit, because
another server process exited abnormally and possibly corrupted shared
memory.
2018-10-04 07:23:39.946 UTC [26143] HINT:  In a moment you should be able to
reconnect to the database and repeat your command.
2018-10-04 07:23:39.947 UTC [26146] postgres@egrul WARNING:  terminating
connection because of crash of another server process
2018-10-04 07:23:39.947 UTC [26146] postgres@egrul DETAIL:  The postmaster
has commanded this server process to roll back the current transaction and
exit, because another server process exited abnormally and possibly
corrupted shared memory.
2018-10-04 07:23:39.947 UTC [26146] postgres@egrul HINT:  In a moment you
should be able to reconnect to the database and repeat your command.
2018-10-04 07:23:39.949 UTC [26157] postgres@postgres FATAL:  the database
system is in recovery mode
2018-10-04 07:23:39.969 UTC [17114] LOG:  all server processes terminated;
reinitializing
2018-10-04 07:23:40.011 UTC [26158] LOG:  database system was interrupted;
last known up at 2018-10-04 07:23:20 UTC
2018-10-04 07:23:40.942 UTC [26158] LOG:  database system was not properly
shut down; automatic recovery in progress
2018-10-04 07:23:40.947 UTC [26158] LOG:  redo starts at 18/32CAACA0
2018-10-04 07:23:40.947 UTC [26158] LOG:  invalid record length at
18/32CAACD8: wanted 24, got 0
2018-10-04 07:23:40.947 UTC [26158] LOG:  redo done at 18/32CAACA0
2018-10-04 07:23:40.976 UTC [17114] LOG:  database system is ready to accept
connections


We did a very quick research and believe the error is somewhere in
xmlParseBalancedChunkMemory handling code.


pgsql-bugs by date:

Previous
From: Sergei Kornilov
Date:
Subject: Re: Is postgresql-client-11 missing from the PGDG repositories for Debian?
Next
From: Michael Paquier
Date:
Subject: Re: BUG #15420: Server crash. Segmentation fault when parsing xmlfile