Thread

Commits

  1. Avoid null pointer dereference crash after OOM in Snowball stemmers.

  2. Update to latest Snowball sources.

  1. [PATCH] snowball: fix potential NULL dereference

    m.korotkov@postgrespro.ru — 2025-02-11T08:52:29Z

    Hi all,
    I found the case of potential NULL pointer dereference.
    In snowball/libstemmer/api.c if we transfer control to the SN_create_env() function
    by using the error label when there is a memory allocation error of z->p or z->S,
    we can then dereference the NULL pointer z->S in the function SN_close_env().
    Added the pointer check for avoiding a potential problem.
    ---
    Best regards, Korotkov Maksim
    PostgresPro
    m.korotkov@postgrespro.ru
    
  2. Re: [PATCH] snowball: fix potential NULL dereference

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-02-11T16:53:37Z

    =?utf-8?q?=D0=9A=D0=BE=D1=80=D0=BE=D1=82=D0=BA=D0=BE=D0=B2_=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC?= <m.korotkov@postgrespro.ru> writes:
    > I found the case of potential NULL pointer dereference.
    > In snowball/libstemmer/api.c if we transfer control to the SN_create_env() function
    > by using the error label when there is a memory allocation error of z->p or z->S,
    > we can then dereference the NULL pointer z->S in the function SN_close_env().
    > Added the pointer check for avoiding a potential problem.
    
    I believe you are right: OOM partway through SN_create_env would fail.
    However, backend/snowball is not our code so applying our own local
    patch is not the way to fix it.  You should report this upstream;
    see src/backend/snowball/README.
    
    (Whenever they apply the patch, we should then re-sync...)
    
    			regards, tom lane
    
    
    
    
  3. Re: [PATCH] snowball: fix potential NULL dereference

    m.korotkov@postgrespro.ru — 2025-02-17T12:12:25Z

    Hi
    On 2025-02-11 19:53, Tom Lane wrote:
    > You should report this upstream;
    > (Whenever they apply the patch, we should then re-sync...)
    
    FYI, the patch to fix this problem was applied by upstream.
    ---
    Best regards, Korotkov Maksim
    PostgresPro
    m.korotkov@postgrespro.ru
    
    
    
    
  4. Re: [PATCH] snowball: fix potential NULL dereference

    Tom Lane <tgl@sss.pgh.pa.us> — 2025-02-18T16:13:48Z

    Maksim Korotkov <m.korotkov@postgrespro.ru> writes:
    > On 2025-02-11 19:53, Tom Lane wrote:
    >> You should report this upstream;
    >> (Whenever they apply the patch, we should then re-sync...)
    
    > FYI, the patch to fix this problem was applied by upstream.
    
    Thanks.  Barring objections, I'll do a full resync per
    src/backend/snowball/README on HEAD, and then extract just
    the null-dereference fix to apply to our back branches.
    
    			regards, tom lane