View Issue Details

IDProjectCategoryView StatusLast Update
0024088Open CASCADEOCCT:DRAWpublic2014-05-05 13:37
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2008 
Product Version6.3.1 
Target Version6.7.1Fixed in Version6.7.1 
Summary0024088: Unsafe window handle management in Draw using GetWindowLong
DescriptionDraw/MainWindow.cxx contains code which uses GetWindowLong/SetWindowLong functions to store window handle.

This is invalid on x86_64 systems and may cause crash if handle value exceed 32-bit boundary.

Also CLIENTWND is set to 0 which looks suspicions (DWL_MSGRESULT is not for custom use according to MSDN).
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0023904 closedkgv Multiple warning on Windows x86_64 target concerning WinAPI usage 

Activities

omy

2014-01-09 12:25

developer   ~0027417

Dear kgv,
Please, review the changes made in branch CR24088.

kgv

2014-01-09 16:15

developer   ~0027420

Dear omy,

please proceed the same issues within other files in Draw package.
(like this one:)
#ifndef _WIN64
  hInstance = (HANDLE)GetWindowLong(hWndFrame, GWL_HINSTANCE);
#else
  hInstance = (HANDLE)GetWindowLong(hWndFrame, GWLP_HINSTANCE);
#endif

omy

2014-01-10 10:45

developer   ~0027430

Dear kgv,
I've made the necessary corrections.
Please, review the branch CR24088_1

kgv

2014-01-10 12:29

developer   ~0027432

Dear omy,

-  DWORD aWinStyle   = GetWindowLong (win, GWL_STYLE);
-  DWORD aWinStyleEx = GetWindowLong (win, GWL_EXSTYLE);
+  DWORD aWinStyle   = GetWindowLongPtr (win, GWL_STYLE);
+  DWORD aWinStyleEx = GetWindowLongPtr (win, GWL_EXSTYLE);

these changes are unrelated to bug.
Other part of the patch looks OK.

omy

2014-01-10 12:56

developer   ~0027433

Dear kgv,
I've reverted the mentioned changes.
Please, review.

kgv

2014-01-10 13:53

developer   ~0027434

Dear Bugmaster,

patch in branch CR24088_1 is ready for testing.

mkv

2014-01-13 14:08

tester   ~0027451

Dear BugMaster,

Branch CR24088_1 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: a5d18d0ce61475b82bea512527f028fae176585e

Number of compiler warnings:

occt component :
Linux: 54 (55 on master)
Windows: 1 (1 on master)

products component :
Linux: 20 (20 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 358021636 / 357072716
Total CPU difference: 44356.07000000028 / 42990.47999999986

Testing on Windows:
Total MEMORY difference: 414002516 / 412488216
Total CPU difference: 34128.8125 / 32601.78125

There are not differences in images found by testdiff.

Related Changesets

occt: master e89e2d67

2014-01-16 08:16:56

omy


Committer: bugmaster Details Diff
0024088: Unsafe window handle management in Draw using GetWindowLong

Replaced Get-/SetWindowLong with Get-/SetWindowLongPtr in files of TKDraw.

Reverted the unrelated changes
Affected Issues
0024088
mod - src/Draw/CommandWindow.cxx Diff File
mod - src/Draw/Draw_Window.cxx Diff File
mod - src/Draw/init.cxx Diff File
mod - src/Draw/MainWindow.cxx Diff File

Issue History

Date Modified Username Field Change
2013-07-25 12:54 kgv New Issue
2013-07-25 12:54 kgv Assigned To => mkv
2013-07-25 12:55 kgv Relationship added related to 0023904
2013-07-25 12:55 kgv Target Version => 6.7.0
2013-07-29 15:47 mkv Assigned To mkv => kgv
2013-07-29 15:47 mkv Status new => assigned
2013-10-18 07:38 kgv Product Version => 6.3.1
2013-10-18 07:38 kgv Target Version 6.7.0 => 6.7.1
2014-01-08 14:55 kgv Assigned To kgv => omy
2014-01-09 12:25 omy Note Added: 0027417
2014-01-09 12:25 omy Assigned To omy => kgv
2014-01-09 12:25 omy Status assigned => resolved
2014-01-09 16:15 kgv Note Added: 0027420
2014-01-09 16:15 kgv Assigned To kgv => omy
2014-01-09 16:15 kgv Status resolved => assigned
2014-01-10 10:45 omy Note Added: 0027430
2014-01-10 10:45 omy Assigned To omy => kgv
2014-01-10 10:45 omy Status assigned => resolved
2014-01-10 12:29 kgv Note Added: 0027432
2014-01-10 12:29 kgv Assigned To kgv => omy
2014-01-10 12:29 kgv Status resolved => assigned
2014-01-10 12:56 omy Note Added: 0027433
2014-01-10 12:56 omy Assigned To omy => kgv
2014-01-10 12:56 omy Status assigned => resolved
2014-01-10 13:53 kgv Note Added: 0027434
2014-01-10 13:53 kgv Assigned To kgv => bugmaster
2014-01-10 13:53 kgv Status resolved => reviewed
2014-01-10 14:09 mkv Assigned To bugmaster => mkv
2014-01-13 14:08 mkv Note Added: 0027451
2014-01-13 14:09 mkv Test case number => Not needed
2014-01-13 14:09 mkv Assigned To mkv => bugmaster
2014-01-13 14:09 mkv Status reviewed => tested
2014-01-21 11:22 bugmaster Changeset attached => occt master e89e2d67
2014-01-21 11:22 bugmaster Status tested => verified
2014-01-21 11:22 bugmaster Resolution open => fixed
2014-05-05 13:34 aiv Status verified => closed
2014-05-05 13:37 aiv Fixed in Version => 6.7.1