View Issue Details

IDProjectCategoryView StatusLast Update
0033102LazarusIDEpublic2018-01-31 23:16
ReporterMartin Friebe Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilitysometimes
Status resolvedResolutionfixed 
Platformw32OSwin 
Product Version1.9 (SVN) 
Summary0033102: w32 IDE Crash / range check, when accessing main menu of IDE
DescriptionI 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
  Stack trace:
  $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
  $7618FD92
  $7618FE6A
  $76189D8A
  $76189FAD
  $77AE5D0E
  $761903CB
  $7527AF85
  $7528B5CA
  $7527865F
  $752725F4
  $7618982B
  $005631EF line 84 of win32/win32callback.inc
  $00568B11 line 2602 of win32/win32callback.inc
TagsNo tags attached.
Fixed in Revisionr57200
LazTarget-
Widgetset
Attached Files

Relationships

related to 0033070 closedJuha Manninen Hints mainmenu submenus are mixed up. Wrong hints are reported 

Activities

Martin Friebe

2018-01-30 19:06

manager   ~0106129

Menu := LParam

Menu is a DWord
LParam is a PtrInt

Serge Anvarov

2018-01-30 21:04

reporter   ~0106130

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.

Martin Friebe

2018-01-30 21:50

manager   ~0106132

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

jamie philbrook

2018-01-31 01:53

reporter   ~0106135

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.

Ondrej Pokorny

2018-01-31 10:34

developer   ~0106140

> A simple type cast should do, if the code is otherwise correct.

Yes, a cast is needed here.

Juha Manninen

2018-01-31 13:31

developer   ~0106142

Last edited: 2018-01-31 13:32

View 2 revisions

Ok, it would be:
  Menu := HMENU(LParam)
Please confirm.
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.

Martin Friebe

2018-01-31 15:40

manager   ~0106145

yes it will be Menu := HMENU(LParam)

I have not looked at the commit/patch in question: Is this the only such assignment?

Juha Manninen

2018-01-31 23:16

developer   ~0106157

Yes it was the only such assignment.
Please test with r57200.

Issue History

Date Modified Username Field Change
2018-01-30 19:04 Martin Friebe New Issue
2018-01-30 19:06 Martin Friebe Note Added: 0106129
2018-01-30 21:04 Serge Anvarov Note Added: 0106130
2018-01-30 21:50 Martin Friebe Note Added: 0106132
2018-01-30 21:50 Martin Friebe Relationship added related to 0033070
2018-01-30 21:51 Martin Friebe Assigned To => Juha Manninen
2018-01-30 21:51 Martin Friebe Status new => assigned
2018-01-31 01:53 jamie philbrook Note Added: 0106135
2018-01-31 10:34 Ondrej Pokorny Note Added: 0106140
2018-01-31 13:31 Juha Manninen Note Added: 0106142
2018-01-31 13:32 Juha Manninen Note Edited: 0106142 View Revisions
2018-01-31 15:40 Martin Friebe Note Added: 0106145
2018-01-31 23:16 Juha Manninen Fixed in Revision => r57200
2018-01-31 23:16 Juha Manninen Note Added: 0106157
2018-01-31 23:16 Juha Manninen Status assigned => resolved
2018-01-31 23:16 Juha Manninen Resolution open => fixed