From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | andrew(at)tao11(dot)riddles(dot)org(dot)uk |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #8453: uninitialized memory access in pg_receivexlog and other bugs |
Date: | 2013-09-16 19:43:35 |
Message-ID: | 52375F67.3040503@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 15.09.2013 15:02, andrew(at)tao11(dot)riddles(dot)org(dot)uk wrote:
> The following bug has been logged on the website:
>
> Bug reference: 8453
> Logged by: Andrew Gierth
> Email address: andrew(at)tao11(dot)riddles(dot)org(dot)uk
> PostgreSQL version: 9.3.0
> Operating system: any
> Description:
>
> The first snprintf in writeTimeLineHistoryFile in receivelog.c accesses
> uninitialized data in the "path" variable, thus creating the .tmp file in a
> random place (usually the current dir, leading to unexpected EXDEV errors on
> the rename).
Ouch, that was a silly bug!
> Also, receivexlog is ignoring .partial and .history files when determining
> which timeline to start streaming from, which means that if there are two
> timeline changes that are not separated by a WAL segment switch, it will
> fail to operate due to attempting to start from a too-old timeline (for
> which xlogs are not available on the server).
There's nothing we can do with .history files here. The point is to find
out how far we have already received WAL, and the presence of a .history
file doesn't tell you anything about that.
There is a comment about .partial files though:
> /*
> * Check if the filename looks like an xlog file, or a .partial file.
> * Xlog files are always 24 characters, and .partial files are 32
> * characters.
> */
> if (strlen(dirent->d_name) != 24 ||
> strspn(dirent->d_name, "0123456789ABCDEF") != 24)
> continue;
The comment says that .partial files are taken into account, but the
code doesn't match the comment.
Attached is a patch to fix both of these issues. I'm too tired right now
to thoroughly test it and commit, so I'll get back to this tomorrow.
Meanwhile, please take a look and let me know if you can see something
wrong.
- Heikki
Attachment | Content-Type | Size |
---|---|---|
fix-pg_receivexlog-bugs-1.patch | text/x-diff | 4.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2013-09-16 19:59:23 | Re: BUG #8453: uninitialized memory access in pg_receivexlog and other bugs |
Previous Message | lrr | 2013-09-16 16:51:05 | BUG #8458: Missing Fedora RPMs |