Skip to content

Commit c766094

Browse files
committed
update
1 parent 8d89ad4 commit c766094

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

_posts/2025-06-22-02.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,5 +389,38 @@ void ObfuscationSEHTest() {
389389
}
390390
```
391391

392+
## Avoiding C++ exception handlers
393+
394+
SEH works with Windows system specifications. C++ EH, on the other hand, depends on the compiler specification (e.g. MSVC/Clang/GCC/Etc.), which can be circumvented by using the SDK as described below.
395+
396+
1. Unlike SEH, Catch syntax in C++ is represented as a separate function, so we apply the SDK separately as shown below.
397+
2. In addition, the C++ EH records where exceptions can be thrown.
398+
For this reason, code that can throw exceptions must be excluded from SDK sections.
399+
400+
```cpp
401+
#pragma optimize("", off)
402+
void test() {
403+
try {
404+
VL_OBFUSCATION_BEGIN;
405+
406+
printf(" > ObfuscationCxxEHTest \n");
407+
408+
VL_OBFUSCATION_END;
409+
410+
// *** Raise Exception
411+
throw std::runtime_error("Something went wrong - 1");
412+
}
413+
catch (...) {
414+
VL_OBFUSCATION_BEGIN;
415+
416+
printf(" > ObfuscationCxxEHTest Catch .. \n");
417+
418+
VL_OBFUSCATION_END;
419+
}
420+
421+
return;
422+
}
423+
```
424+
392425
---
393426

0 commit comments

Comments
 (0)