Thread: Debugger crashes when setting a value with quotes

Debugger crashes when setting a value with quotes

From
Heikki Linnakangas
Date:
Steps to reproduce:

1. Create a function:

CREATE OR REPLACE FUNCTION barfunc()
   RETURNS integer AS
$BODY$
  DECLARE
    var int4;
  BEGIN
    var := 1;
    IF 1=2 THEN NULL; END IF;
    RETURN var;
  END
$BODY$
   LANGUAGE plpgsql;

2. Start debugging on the function.

3. Change the value of variable 'var' in the debugger GUI to something
with a single quote. Like "'123".

4. Move focus from the cell, pgAdmin3 crashes

Looking at the code in ctlCodeWindow.cpp, it seems that the new value is
not quoted properly in the call to pldbg_deposit_value() server function.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

Re: Debugger crashes when setting a value with quotes

From
Dave Page
Date:
On Thu, Mar 24, 2011 at 2:54 PM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:
> Steps to reproduce:
>
> 1. Create a function:
>
> CREATE OR REPLACE FUNCTION barfunc()
>  RETURNS integer AS
> $BODY$
>  DECLARE
>   var int4;
>  BEGIN
>   var := 1;
>   IF 1=2 THEN NULL; END IF;
>   RETURN var;
>  END
> $BODY$
>  LANGUAGE plpgsql;
>
> 2. Start debugging on the function.
>
> 3. Change the value of variable 'var' in the debugger GUI to something with
> a single quote. Like "'123".
>
> 4. Move focus from the cell, pgAdmin3 crashes
>
> Looking at the code in ctlCodeWindow.cpp, it seems that the new value is not
> quoted properly in the call to pldbg_deposit_value() server function.

I've committed a fix for this - thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Re: Debugger crashes when setting a value with quotes

From
Timon
Date:
commit  6fe0f783fc6a9e85a00df211b25195eb3f3ac29e

g++ -DHAVE_CONFIG_H -I. -I..
-DDATA_DIR=\"/usr/local/pgadmin3/share/pgadmin3/\"
-I../pgadmin/include   -I/usr/include -I/usr/include/pgsql
-DHAVE_CONNINFO_PARSE -I/usr/lib64/wx/include/gtk2-unicode-release-2.8
-I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
-D__WXGTK__ -DEMBED_XRC -I/usr/include/libxml2 -I/usr/include/libxml2
-O2 -MT ctlCodeWindow.o -MD -MP -MF .deps/ctlCodeWindow.Tpo -c -o
ctlCodeWindow.o `test -f './debugger/ctlCodeWindow.cpp' || echo
'./'`./debugger/ctlCodeWindow.cpp
./debugger/ctlCodeWindow.cpp: In member function 'void
ctlCodeWindow::OnVarChange(wxGridEvent&)':
./debugger/ctlCodeWindow.cpp:1306:176: error: cannot pass objects of
non-trivially-copyable type 'class wxString' through '...'
./debugger/ctlCodeWindow.cpp:1306:176: error: cannot pass objects of
non-trivially-copyable type 'class wxString' through '...'
make[3]: *** [ctlCodeWindow.o] Error 1

gcc-4.5.1-4.fc14.x86_64

2011/3/24 Dave Page <dpage@pgadmin.org>:
> On Thu, Mar 24, 2011 at 2:54 PM, Heikki Linnakangas
> <heikki.linnakangas@enterprisedb.com> wrote:
>> Steps to reproduce:
>>
>> 1. Create a function:
>>
>> CREATE OR REPLACE FUNCTION barfunc()
>>  RETURNS integer AS
>> $BODY$
>>  DECLARE
>>   var int4;
>>  BEGIN
>>   var := 1;
>>   IF 1=2 THEN NULL; END IF;
>>   RETURN var;
>>  END
>> $BODY$
>>  LANGUAGE plpgsql;
>>
>> 2. Start debugging on the function.
>>
>> 3. Change the value of variable 'var' in the debugger GUI to something with
>> a single quote. Like "'123".
>>
>> 4. Move focus from the cell, pgAdmin3 crashes
>>
>> Looking at the code in ctlCodeWindow.cpp, it seems that the new value is not
>> quoted properly in the call to pldbg_deposit_value() server function.
>
> I've committed a fix for this - thanks.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>



--
All bugs reserved

Re: Debugger crashes when setting a value with quotes

From
Dave Page
Date:
Thanks - should be OK now.

On Mon, Mar 28, 2011 at 8:08 AM, Timon <timosha@gmail.com> wrote:
> commit  6fe0f783fc6a9e85a00df211b25195eb3f3ac29e
>
> g++ -DHAVE_CONFIG_H -I. -I..
> -DDATA_DIR=\"/usr/local/pgadmin3/share/pgadmin3/\"
> -I../pgadmin/include   -I/usr/include -I/usr/include/pgsql
> -DHAVE_CONNINFO_PARSE -I/usr/lib64/wx/include/gtk2-unicode-release-2.8
> -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
> -D__WXGTK__ -DEMBED_XRC -I/usr/include/libxml2 -I/usr/include/libxml2
> -O2 -MT ctlCodeWindow.o -MD -MP -MF .deps/ctlCodeWindow.Tpo -c -o
> ctlCodeWindow.o `test -f './debugger/ctlCodeWindow.cpp' || echo
> './'`./debugger/ctlCodeWindow.cpp
> ./debugger/ctlCodeWindow.cpp: In member function 'void
> ctlCodeWindow::OnVarChange(wxGridEvent&)':
> ./debugger/ctlCodeWindow.cpp:1306:176: error: cannot pass objects of
> non-trivially-copyable type 'class wxString' through '...'
> ./debugger/ctlCodeWindow.cpp:1306:176: error: cannot pass objects of
> non-trivially-copyable type 'class wxString' through '...'
> make[3]: *** [ctlCodeWindow.o] Error 1
>
> gcc-4.5.1-4.fc14.x86_64
>
> 2011/3/24 Dave Page <dpage@pgadmin.org>:
>> On Thu, Mar 24, 2011 at 2:54 PM, Heikki Linnakangas
>> <heikki.linnakangas@enterprisedb.com> wrote:
>>> Steps to reproduce:
>>>
>>> 1. Create a function:
>>>
>>> CREATE OR REPLACE FUNCTION barfunc()
>>>  RETURNS integer AS
>>> $BODY$
>>>  DECLARE
>>>   var int4;
>>>  BEGIN
>>>   var := 1;
>>>   IF 1=2 THEN NULL; END IF;
>>>   RETURN var;
>>>  END
>>> $BODY$
>>>  LANGUAGE plpgsql;
>>>
>>> 2. Start debugging on the function.
>>>
>>> 3. Change the value of variable 'var' in the debugger GUI to something with
>>> a single quote. Like "'123".
>>>
>>> 4. Move focus from the cell, pgAdmin3 crashes
>>>
>>> Looking at the code in ctlCodeWindow.cpp, it seems that the new value is not
>>> quoted properly in the call to pldbg_deposit_value() server function.
>>
>> I've committed a fix for this - thanks.
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> --
>> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgadmin-hackers
>>
>
>
>
> --
> All bugs reserved
>



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company