Skip to content

exception in action of a breakpoint will cause crash #85

@swmcl

Description

@swmcl

The traceback is like:
debug.loop()
File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\debug.py", line 1178, in loop
self.next()
File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\debug.py", line 1140, in next
self.dispatch()
File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\debug.py", line 992, in dispatch
return EventDispatcher.dispatch(self, event)
File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\event.py", line 1978, in dispatch
bCallHandler = pre_handler(event)
File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\breakpoint.py", line 3477, in _notify_breakpoint
bCallHandler = bp.run_action(event)
File "D:\WM_SHI\PROGRAM\Pycharm\venv310\lib\site-packages\winappdbg\breakpoint.py", line 367, in run_action
msg = msg % (action, traceback.format_exc(e))
File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 183, in format_exc
return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))
File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 135, in format_exception
te = TracebackException(type(value), value, tb, limit=limit, compact=True)
File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 502, in init
self.stack = StackSummary.extract(
File "C:\Users\William SHI\AppData\Local\Programs\Python\Python310\lib\traceback.py", line 357, in extract
if limit >= 0:
TypeError: '>=' not supported between instances of 'AssertionError' and 'int'

And I think this is caused by:
traceback.format_exc(e)
in the:
def run_action(self, event):
"""
Run the action callback for this breakpoint.

:param event: Event that triggered this breakpoint.
:type event: :class:`~winappdbg.event.Event`
"""
action = self.get_action()
if action is not None:
    try:
        return bool(action(event))
    except Exception as e:
        msg = "Breakpoint action callback %r raised an exception: %s"
        msg = msg % (action, traceback.format_exc(e))
        warnings.warn(msg, BreakpointCallbackWarning)
        return False
return True

of the breakpoint.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions