Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#1762 closed defect (fixed)

Incorrect closing of HMODULE in process_by_any_exe_not_immersive::operator()

Reported by: eric@… Assignee: eric@…
Priority: Unknown Milestone: Adblock-Plus-for-Internet-Explorer-1.4
Module: Adblock-Plus-for-Internet-Explorer Keywords: installer
Cc: Blocked By:
Blocking: #1187 Platform: Internet Explorer
Ready: no Confidential: no
Tester: Verified working:
Review URL(s):

http://codereview.adblockplus.org/5195376613130240/

Description

Environment

process_by_any_exe_not_immersive::operator(), used in the installer custom action, uses dynamic loading to use a system call introduced with Windows 8. The return value of LoadLibrary() is an HMODULE, which stands for "handle to a module". It is not, however, an true handle, and should not be closed.

The current version uses a smart handle class which closes the handle to the library. This generates an SEH exception in the operating system.

How to reproduce

Run the installer with MsiBreak at elevated privileges. Attach a debugger, which will trap the exception.

Observed behaviour

The exception shows up reliably in the debugger.

Expected behaviour

There should be no exception

How to Fix the Defect

Remove the use of the smart handle class, which is not only unnecessary but incorrect. Use of the plain return value is sufficient.

Change History (5)

comment:1 Changed 5 years ago by eric@…

Blocking #1187 because it's impossible to see the relevant code because the exception in the debugger closes the installer.

comment:2 Changed 5 years ago by eric@…

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 5 years ago by eric@…

  • Owner set to eric@…

comment:4 Changed 5 years ago by eric@…

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:5 Changed 5 years ago by oleksandr

  • Milestone set to Adblock-Plus-for-Internet-Explorer-1.4
Note: See TracTickets for help on using tickets.