Last change
on this file since 21427 was 21427, checked in by dmik, 15 years ago |
SEH: Save EXCEPTION_RECORD and CONTEXT on heap when jumping back from the exception handler to execute the except() filter expression because they are stored on stack and may be overwritten during execution of the filter expression. This fixes garbage in structures pointed to by _exception_info()'s pointers.
|
File size:
825 bytes
|
Line | |
---|
1 | /*
|
---|
2 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
3 | *
|
---|
4 | * Compiler-level Win32 SEH support for OS/2
|
---|
5 | *
|
---|
6 | * Copyright 2010 Dmitry A. Kuminov
|
---|
7 | */
|
---|
8 |
|
---|
9 | #include "excpt.h"
|
---|
10 |
|
---|
11 | extern void * _Optlink odin_malloc(int);
|
---|
12 |
|
---|
13 | void __seh_makePointers(__seh_PEXCEPTION_FRAME *pFrame,
|
---|
14 | PEXCEPTION_RECORD pRecord, PCONTEXT pContext)
|
---|
15 | {
|
---|
16 | // make copies of Record and Context as we will temporarily
|
---|
17 | // discard the exception handler's stack when jumping to the
|
---|
18 | // except()'s filter function
|
---|
19 | pFrame->Pointers.ExceptionRecord =
|
---|
20 | (PEXCEPTION_RECORD)odin_malloc(sizeof(EXCEPTION_RECORD));
|
---|
21 | *pFrame->Pointers.ExceptionRecord = *pRecord;
|
---|
22 | pFrame->Pointers.ContextRecord =
|
---|
23 | (PCONTEXT)odin_malloc(sizeof(CONTEXT));
|
---|
24 | *pFrame->Pointers.ContextRecord = *pContext;
|
---|
25 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.