Re: BUG #17839: Heap-buffer overflow on float8_to_char with invalid template
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thiago Nunes <thiagotnunes@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2023-03-15T01:45:46Z
Lists: pgsql-bugs
Thiago Nunes <thiagotnunes@gmail.com> writes: > I think your solution deals with all the cases, but I would like to point > out how I fixed it locally. I recalculated Num.zero_end after this line ( > https://github.com/postgres/postgres/blob/REL_15_2/src/backend/utils/adt/formatting.c#L6716 > ): > ``` > Num.zero_end = Num.pre + Num.post; > ``` Hmm ... that seems a bit ad-hoc, because as far as I understand this code, zero_end is supposed to track where is the last '0' format character. That shouldn't change just because we decided that the data value overflowed. regards, tom lane
Commits
-
Fix corner case bug in numeric to_char() some more.
- b081fe4199b6 16.0 landed
- a67c75f82587 15.3 landed
- 8e33fb9ef1df 11.20 landed
- 7cac191057ea 14.8 landed
- 6d3a9a60f785 12.15 landed
- 386a26023afb 13.11 landed