Re: Validate GIN posting lists before decoding them

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Sehrope Sarkuni <sehrope(at)jackdb(dot)com>
Subject: Re: Validate GIN posting lists before decoding them
Date: 2026-11-18 07:00:28
Message-ID: CAJ7c6TMN8AfqLBGAE2gxNYDdXmV2SnQj=tHcsr5nuwT17r5kaA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Sehrope,

> Seven patches:
>
> 0001 bound decode_varbyte() against the segment end
> 0002 check each segment fits within the posting list
> 0003 reject items that are out of range or out of order
> 0004 tests, through gin_leafpage_items()
> 0005 size the output array from len, not the unvalidated nbytes
> 0006 remove unreachable repalloc_array()
> 0007 scope some locals to the loop (cosmetic)

Thanks for the bugreport and the patches.

They apply cleanly, the tests pass, and each of the cases catch the
bug. I'm going to change the CF entry to RfC.

--
Best regards,
Aleksander Alekseev

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2026-11-18 07:00:35 Re: Tracking per-RelOptInfo uniqueness during planning
Previous Message Nitin Jadhav 2026-11-18 06:53:30 Re: [PATCH] Check interrupts while draining received WAL