Re: BUG #17725: Sefault when seg_in() called with a large argument

Robins Tharakan <tharakan@gmail.com>

From: Robins Tharakan <tharakan@gmail.com>
To: John Naylor <john.naylor@enterprisedb.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2022-12-20T12:48:19Z
Lists: pgsql-bugs
Hi John,

On Tue, 20 Dec 2022 at 20:44, John Naylor <john.naylor@enterprisedb.com> wrote:
> Neither query shows the reported problem in my environment on master (as of today) or v14, so not sure
> It's possibly relevant that this result is different from the "3.100000e+01" which was shown in your backtrace. Since a few details of this report don't agree with each other, I'm starting to wonder if some other relevant details got lost along the way.

Thanks for taking a look and you're possibly correct.

After trying a few combinations, I see that passing
CFLAGS="-Wuninitialized" (default for my test setup) causes this failure.
Removing the flag gives the error you mention, and possibly why this
may not be easy to reproduce on a production system (unsure).

$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0

# How I trigger compilation
cd ${sourcepth} && git clean -xdf && ./configure
CFLAGS="-Wuninitialized" --prefix=${installpth} && make -j`nproc`
install ...

This is a recent crash on 69f75bf825@REL_12_STABLE

2022-12-20 10:24:53.361 UTC [3087004] LOG:  server process (PID
3182365) was terminated by signal 11: Segmentation fault
2022-12-20 10:24:53.361 UTC [3087004] DETAIL:  Failed process was
running: SELECT seg_in(numeric_out(round(31, 10000)));
2022-12-20 10:24:53.361 UTC [3087004] LOG:  terminating any other
active server processes
2022-12-20 10:24:53.366 UTC [3087004] LOG:  all server processes
terminated; reinitializing

I created this bug-report since I am able to reproduce this at will. But let
me know if this is uninteresting, or if I can provide any other detail to
help in triaging.

-
robins



Commits

  1. Fix contrib/seg to be more wary of long input numbers.