You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Oliver Deakin <ol...@googlemail.com> on 2008/09/11 16:29:33 UTC
[classlib][awt] Bug in WinGraphicsEnvironment.cpp
Hi all,
Im just going through the last of the errors in HARMONY-5976 and there
is a bug in WinGraphicsEnvironment.cpp in the
Java_org_apache_harmony_awt_gl_windows_WinGraphicsConfiguration_createColorModel()
function.
We create the variable "mask" on line 111. If the if-statement on line
126 evaluates false, we enter the else block where mask is still not
initialised. In the cases where the number of bits is 16 or 32, we set
pfType to be PF_16RGB55 or PF_32RGB888. When we then enter the switch
block on line 175, we try to then use the uninitialised mask variable in
calls to NewObject(), which is clearly wrong.
It seems a fix for this would be to move the line initialising mask
(currently line 127) to before the if-statement it is currently inside.
I wanted to check if anyone has any opinions/objections on this? If
there are no objections, I will commit the change.
Regards,
Oliver
--
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
Re: [classlib][awt] Bug in WinGraphicsEnvironment.cpp
Posted by Oliver Deakin <ol...@googlemail.com>.
Hi Alexei,
Yes, I think you could be right. Having read the MSDN reference I don't
see any reason to make the GetDIBits call twice there. The only
difference between the calls is that bmpInfo is already populated in the
second call (by the first), but as far as I can tell this will not make
a difference to the second call and it will just overwrite bmpInfo with
the same data again. I cannot see anything in the MSDN page that
indicates a need to call the function twice.
Does anyone know a reason why this would be called twice?
Regards,
Oliver
Alexei Fedotov wrote:
> Hello, Oliver,
>
> I was trying to understand if the proposed change would be sensible. I
> wonder why we are calling GetDIBits [1] at lines 119-120 twice. Could
> it be a cut & paste error?
>
> Thanks.
>
> [1] http://msdn.microsoft.com/en-us/library/ms532334.aspx
>
>
> On Thu, Sep 11, 2008 at 6:29 PM, Oliver Deakin
> <ol...@googlemail.com> wrote:
>
>> Hi all,
>>
>> Im just going through the last of the errors in HARMONY-5976 and there is a
>> bug in WinGraphicsEnvironment.cpp in the
>> Java_org_apache_harmony_awt_gl_windows_WinGraphicsConfiguration_createColorModel()
>> function.
>>
>> We create the variable "mask" on line 111. If the if-statement on line 126
>> evaluates false, we enter the else block where mask is still not
>> initialised. In the cases where the number of bits is 16 or 32, we set
>> pfType to be PF_16RGB55 or PF_32RGB888. When we then enter the switch block
>> on line 175, we try to then use the uninitialised mask variable in calls to
>> NewObject(), which is clearly wrong.
>>
>> It seems a fix for this would be to move the line initialising mask
>> (currently line 127) to before the if-statement it is currently inside. I
>> wanted to check if anyone has any opinions/objections on this? If there are
>> no objections, I will commit the change.
>>
>> Regards,
>> Oliver
>>
>> --
>> Oliver Deakin
>> Unless stated otherwise above:
>> IBM United Kingdom Limited - Registered in England and Wales with number
>> 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
>> PO6 3AU
>>
>>
>>
>
>
>
>
--
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
Re: [classlib][awt] Bug in WinGraphicsEnvironment.cpp
Posted by Alexei Fedotov <al...@gmail.com>.
Hello, Oliver,
I was trying to understand if the proposed change would be sensible. I
wonder why we are calling GetDIBits [1] at lines 119-120 twice. Could
it be a cut & paste error?
Thanks.
[1] http://msdn.microsoft.com/en-us/library/ms532334.aspx
On Thu, Sep 11, 2008 at 6:29 PM, Oliver Deakin
<ol...@googlemail.com> wrote:
> Hi all,
>
> Im just going through the last of the errors in HARMONY-5976 and there is a
> bug in WinGraphicsEnvironment.cpp in the
> Java_org_apache_harmony_awt_gl_windows_WinGraphicsConfiguration_createColorModel()
> function.
>
> We create the variable "mask" on line 111. If the if-statement on line 126
> evaluates false, we enter the else block where mask is still not
> initialised. In the cases where the number of bits is 16 or 32, we set
> pfType to be PF_16RGB55 or PF_32RGB888. When we then enter the switch block
> on line 175, we try to then use the uninitialised mask variable in calls to
> NewObject(), which is clearly wrong.
>
> It seems a fix for this would be to move the line initialising mask
> (currently line 127) to before the if-statement it is currently inside. I
> wanted to check if anyone has any opinions/objections on this? If there are
> no objections, I will commit the change.
>
> Regards,
> Oliver
>
> --
> Oliver Deakin
> Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
> PO6 3AU
>
>
--
With best regards,
Alexei
Re: [classlib][awt] Bug in WinGraphicsEnvironment.cpp
Posted by Oliver Deakin <ol...@googlemail.com>.
Since there were no objections, I have committed this change at r696220.
Regards,
Oliver
Oliver Deakin wrote:
> Hi all,
>
> Im just going through the last of the errors in HARMONY-5976 and there
> is a bug in WinGraphicsEnvironment.cpp in the
> Java_org_apache_harmony_awt_gl_windows_WinGraphicsConfiguration_createColorModel()
> function.
>
> We create the variable "mask" on line 111. If the if-statement on line
> 126 evaluates false, we enter the else block where mask is still not
> initialised. In the cases where the number of bits is 16 or 32, we set
> pfType to be PF_16RGB55 or PF_32RGB888. When we then enter the switch
> block on line 175, we try to then use the uninitialised mask variable
> in calls to NewObject(), which is clearly wrong.
>
> It seems a fix for this would be to move the line initialising mask
> (currently line 127) to before the if-statement it is currently
> inside. I wanted to check if anyone has any opinions/objections on
> this? If there are no objections, I will commit the change.
>
> Regards,
> Oliver
>
--
Oliver Deakin
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU