1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-18 02:02:55 +03:00

Fix bitmap table scan crash on iterator release

1a0da347a7 replaced Bitmap Table Scan's individual private and
shared iterators with a unified iterator. It neglected, however, to
check if the iterator had already been cleaned up before doing so on
rescan. Add this check both on rescan and end scan to be safe.

Reported-by: Richard Guo
Author: Richard Guo
Discussion: https://postgr.es/m/CAMbWs48nrhcLY1kcd-u9oD%2B6yiS631F_8Fx8ZGsO-BYDwH%2Bbyw%40mail.gmail.com
This commit is contained in:
Melanie Plageman
2024-12-19 11:55:03 -05:00
parent 31b0a8f040
commit 754c610e13
4 changed files with 61 additions and 5 deletions

View File

@@ -1594,7 +1594,7 @@ tbm_begin_iterate(TIDBitmap *tbm, dsa_area *dsa, dsa_pointer dsp)
void
tbm_end_iterate(TBMIterator *iterator)
{
Assert(iterator);
Assert(iterator && !tbm_exhausted(iterator));
if (iterator->shared)
tbm_end_shared_iterate(iterator->i.shared_iterator);