View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0033102||Lazarus||IDE||public||2018-01-30 18:04||2018-01-31 22:16|
|Reporter||Martin Friebe||Assigned To||Juha Manninen|
|Product Version||1.9 (SVN)|
|Summary||0033102: w32 IDE Crash / range check, when accessing main menu of IDE|
|Description||I had several random crashes lately.|
No way to reproduce. But a few of them happened with a range check, when trying to open a main menu entry with the mouse.
TApplication.HandleException Range check error
$00563D85 line 461 of win32/win32callback.inc
$00567814 line 2060 of win32/win32callback.inc
$00568F99 line 2696 of win32/win32callback.inc
$006B8908 line 386 of win32/win32wsforms.pp
$005631EF line 84 of win32/win32callback.inc
$00568B11 line 2602 of win32/win32callback.inc
|Tags||No tags attached.|
|Fixed in Revision||r57200|
Menu := LParam
Menu is a DWord
LParam is a PtrInt
||This code added in the issue 0033070 (my patch). But, Menu: HMENU; HMENU is THandle and same size as PtrInt. And, as far as I know, all the USER handles are 32 bit.|
It's signed vs unsigned.
So if the top bit is set => range check
A simple type cast should do, if the code is otherwise correct.
Also, I don't know the patch, and if other similar assignments may have been introduced
Just a note:
Looking at old Delphi references THandle = integer; I really don't think
that is correct...
Thandle currently uses DWORD/LONGWORD or QWORD for 64bit which is what it
should be to match MS targets and to not use signed types incase the OS decides
to use that upper bit..
MS uses PVOID type which is a untyped pointer.
> A simple type cast should do, if the code is otherwise correct.
Yes, a cast is needed here.
Ok, it would be:
Menu := HMENU(LParam)
I can commit it although I am not able to test Windows code for a week now.
I don't know why I or Serge Anvarov did not get range check errors in earlier tests.
yes it will be Menu := HMENU(LParam)
I have not looked at the commit/patch in question: Is this the only such assignment?
Yes it was the only such assignment.
Please test with r57200.
|2018-01-30 18:04||Martin Friebe||New Issue|
|2018-01-30 18:06||Martin Friebe||Note Added: 0106129|
|2018-01-30 20:04||Serge Anvarov||Note Added: 0106130|
|2018-01-30 20:50||Martin Friebe||Note Added: 0106132|
|2018-01-30 20:50||Martin Friebe||Relationship added||related to 0033070|
|2018-01-30 20:51||Martin Friebe||Assigned To||=> Juha Manninen|
|2018-01-30 20:51||Martin Friebe||Status||new => assigned|
|2018-01-31 00:53||jamie philbrook||Note Added: 0106135|
|2018-01-31 09:34||Ondrej Pokorny||Note Added: 0106140|
|2018-01-31 12:31||Juha Manninen||Note Added: 0106142|
|2018-01-31 12:32||Juha Manninen||Note Edited: 0106142||View Revisions|
|2018-01-31 14:40||Martin Friebe||Note Added: 0106145|
|2018-01-31 22:16||Juha Manninen||Fixed in Revision||=> r57200|
|2018-01-31 22:16||Juha Manninen||Note Added: 0106157|
|2018-01-31 22:16||Juha Manninen||Status||assigned => resolved|
|2018-01-31 22:16||Juha Manninen||Resolution||open => fixed|