Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimerHook Windows API issues #3662

Closed
WaynePhillipsEA opened this issue Jan 1, 2018 · 0 comments
Closed

TimerHook Windows API issues #3662

WaynePhillipsEA opened this issue Jan 1, 2018 · 0 comments
Labels
bug Identifies work items for known bugs difficulty-01-duckling Issue where no particularly involved knowledge of the internal API is needed. up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky

Comments

@WaynePhillipsEA
Copy link
Contributor

A few issues identified in TimerHook.cs;

  1. the timerId generated is never stored back to the class _timerId field. Therefore, in Detach(), a zero timerId is passed to KillTimer() and GlobalDeleteAtom().

Subsequently, your timer hook never gets released, and so this can cause the WinAPI to try calling into your managed callback even after the CLR has been unloaded. The callback will be a released memory address after the CLR unload, and so a potential crash situation.

  1. GlobalAddAtom can fail with zero return value, but this is unchecked.
  2. SetTimer can fail with a zero return value, but this is unchecked.

Easy to fix :) Happy new year

@Vogel612 Vogel612 added bug Identifies work items for known bugs difficulty-01-duckling Issue where no particularly involved knowledge of the internal API is needed. up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky labels Jan 1, 2018
bclothier added a commit to bclothier/Rubberduck that referenced this issue Jan 1, 2018
…rom Win32 API which will not necessarily throw exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs difficulty-01-duckling Issue where no particularly involved knowledge of the internal API is needed. up-for-grabs Use this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky
Projects
Development

No branches or pull requests

2 participants