norgepaul / TChromeTabs

Comprehensive Delphi implementation of Chrome's tab system
Other
215 stars 78 forks source link

TChromeTabsGlassForm reads from uninitialized local variable #29

Closed igelbox closed 3 years ago

igelbox commented 9 years ago

procedure TChromeTabsGlassForm.WMNCHitTest(var Message: TWMNCHitTest); variable - IconRect

Sometimes this causes WM_CLOSE when double-clicking on window title double-clicking region

norgepaul commented 8 years ago

Sorry, I'm unable to reproduce the problem. Can you send me a small demo?

igelbox commented 8 years ago

This problem reproduced only sometimes (because it depends on previous stack-memory-cell values), Therefore i cannot make a demo. But this error is obvious from the static code analysis: local variable "IconRect" is never initialised but used in "if (ClientPos.X < IconRect.Right) and".

mksjgj commented 7 years ago

did this bug fixed? but the IconRect is still uninitialized before accessing it.

landrix commented 3 years ago

No further findings.

mksjgj commented 3 years ago

if you check the code carefully, you can find the pitfall: unit: ChromeTabsGlassForm.pas method: TChromeTabsGlassForm.WMNCHitTest local variable: IconRect
your code read this local variable before initialize it: if (ClientPos.X < IconRect.Right) and ...

i can not express it more clearly

landrix commented 3 years ago

i found some infos and an old issue about this

5

https://stackoverflow.com/questions/40041013/caption-buttons-not-respond-to-mouse-clicks-after-non-client-painting-with-dwm

i've added

IconRect := GetSysIconRect;