Re: [PATCH] Fix crash when disabling auto commit

From: Ashesh Vashi <ashesh(dot)vashi(at)enterprisedb(dot)com>
To: Sanket Mehta <sanket(dot)mehta(at)enterprisedb(dot)com>
Cc: John Obaterspok <john(dot)obaterspok(at)gmail(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Fix crash when disabling auto commit
Date: 2015-06-14 16:44:44
Message-ID: CAG7mmowqu6Pxm1vuN32obfQ8WBh=K-Kd7GrkRsBNzatDNaYv9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

John,

As I understand correctly, 8th character will be '\0' (null character).
Hence - wxIsAlpha() will come out of the loop in general.

But - it is possible every platform has different behaviour for wxWidgets.
Can you please be specific about the operating system?

--
Thanks & Regards,

Ashesh Vashi
EnterpriseDB (Software Architect)

[Sent through mobile]
On Jun 14, 2015 2:41 PM, "Sanket Mehta" <sanket(dot)mehta(at)enterprisedb(dot)com>
wrote:

> Hi John,
>
> I have tried the same, I am not getting any out of the bounds error, it
> simply comes out of the while loop.
>
> Regards,
> Sanket Mehta
> Sr Software engineer
> Enterprisedb
>
> On Sun, Jun 14, 2015 at 2:00 PM, John Obaterspok <
> john(dot)obaterspok(at)gmail(dot)com> wrote:
>
>> Hello Sanket,
>>
>> Just enter "rollback" and exec
>>
>> The
>> while(wxIsalpha(query.GetChar(wordlen)))
>> wordlen++;
>>
>> As the 'k' in rollback is a char it also tries the next character
>> (worklen = 8) which causes out of bounds check.
>>
>> -- john
>>
>>
>> 2015-06-12 13:25 GMT+02:00 Sanket Mehta <sanket(dot)mehta(at)enterprisedb(dot)com>:
>>
>>> Hi John,
>>>
>>> I have tried to reproduce the scenario but not able to reproduce the
>>> crash in my system.
>>> can you please provide your steps which causes crash on your machine?
>>>
>>> Regards,
>>> Sanket Mehta
>>> Sr Software engineer
>>> Enterprisedb
>>>
>>> On Fri, Jun 12, 2015 at 11:50 AM, Sanket Mehta <
>>> sanket(dot)mehta(at)enterprisedb(dot)com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am looking into the same and few other issues in code and will send
>>>> the patch soon.
>>>>
>>>>
>>>> Regards,
>>>> Sanket Mehta
>>>> Sr Software engineer
>>>> Enterprisedb
>>>>
>>>> On Fri, Jun 12, 2015 at 1:49 AM, John Obaterspok <
>>>> john(dot)obaterspok(at)gmail(dot)com> wrote:
>>>>
>>>>> Fix crash when string has only alphas (like 'rollback')
>>>>>
>>>>> diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp
>>>>> index b5a2f56..110bbc7 100644
>>>>> --- a/pgadmin/frm/frmQuery.cpp
>>>>> +++ b/pgadmin/frm/frmQuery.cpp
>>>>> @@ -2522,7 +2522,7 @@ bool frmQuery::isBeginNotRequired(wxString query)
>>>>> /*
>>>>> * Check word length (since "beginx" is not "begin").
>>>>> */
>>>>> - while(wxIsalpha(query.GetChar(wordlen)))
>>>>> + while(wordlen < query.Length() && wxIsalpha(query.GetChar(wordlen)))
>>>>> wordlen++;
>>>>>
>>>>> /*
>>>>>
>>>>
>>>>
>>>
>>
>

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2015-06-15 05:10:15 Re: SSH error messages not shown
Previous Message Dave Page 2015-06-14 09:43:34 Re: valgrind complains a lot when trying to establish an SSH tunnel while giving wrong key