psqlodbc crashes while collecting diagnostic records with SQLGetDiagRecW

From: Andrey Sukhanov <siwenter(at)gmail(dot)com>
To: pgsql-odbc(at)lists(dot)postgresql(dot)org
Subject: psqlodbc crashes while collecting diagnostic records with SQLGetDiagRecW
Date: 2024-02-22 06:29:35
Message-ID: 112f6883-34e4-4372-8bda-d04f45ee31bf@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Dear pgsql-odbc developers,

Windows 10,  psqlodbc 16 (psqlodbc35w.dll), postgresql 11.
Getting certain amount of diagnostic records with SQLGetDiagRecW crashes
the application with memory access violation.

Steps to reproduce:
1. Create procedure:
CREATE OR REPLACE PROCEDURE crashme()
LANGUAGE plpgsql
AS $$
BEGIN
FOR i IN 1..841 LOOP
        RAISE NOTICE 'msgmsgmsgmsg (%)', i;
END LOOP;
END; $$;

2. Use example code in attachments.
3. Application crashes with memory access violation after calling
SQLGetDiagRecW function, with iRecord = 332.
Application doesn't crash if number of iterations in  procedure's for
loop is changed.
Expected outcome: SQLGetDiagRecW would return SQL_NO_DATA when there's
no more diagnostic records.

Regards,
Andrey

Attachment Content-Type Size
sqlgetdiagrec_crash.cpp text/x-c++src 3.4 KB

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Alexander Yi 2024-02-26 06:59:53 Use Postgres ODBC in MacOS's Microsoft Office Excel
Previous Message Sugimoto, Haku 2024-01-29 05:17:34 Inquiry about EOL information for psqlODBC driver