| Revision 4152,
1.3 KB
checked in by sam, 3 years ago
(diff) |
|
Try to call _zz_init() as soon as possible. Otherwise, preloaded libraries
might be confused about half the calls actually working.
|
-
Property svn:keywords set to
Id
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * zzuf - general purpose fuzzer |
|---|
| 3 | * Copyright (c) 2006 Sam Hocevar <sam@zoy.org> |
|---|
| 4 | * All Rights Reserved |
|---|
| 5 | * |
|---|
| 6 | * $Id$ |
|---|
| 7 | * |
|---|
| 8 | * This program is free software. It comes without any warranty, to |
|---|
| 9 | * the extent permitted by applicable law. You can redistribute it |
|---|
| 10 | * and/or modify it under the terms of the Do What The Fuck You Want |
|---|
| 11 | * To Public License, Version 2, as published by Sam Hocevar. See |
|---|
| 12 | * http://sam.zoy.org/wtfpl/COPYING for more details. |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | /* |
|---|
| 16 | * lib-load.h: preload library functions |
|---|
| 17 | */ |
|---|
| 18 | |
|---|
| 19 | /* Symbol loading stuff */ |
|---|
| 20 | #define STR(x) #x |
|---|
| 21 | #define ORIG(x) x##_orig |
|---|
| 22 | |
|---|
| 23 | #ifdef HAVE_DLFCN_H |
|---|
| 24 | # include <dlfcn.h> |
|---|
| 25 | # define NEW(x) x |
|---|
| 26 | # define LOADSYM(x) \ |
|---|
| 27 | do { \ |
|---|
| 28 | if(!ORIG(x)) \ |
|---|
| 29 | { \ |
|---|
| 30 | /* XXX: we try to initialise libzzuf as soon as possible, \ |
|---|
| 31 | * otherwise we may miss a lot of stuff if we wait for \ |
|---|
| 32 | * the linker to load us fully. */ \ |
|---|
| 33 | _zz_init(); \ |
|---|
| 34 | ORIG(x) = dlsym(RTLD_NEXT, STR(x)); \ |
|---|
| 35 | } \ |
|---|
| 36 | if(!ORIG(x)) \ |
|---|
| 37 | abort(); \ |
|---|
| 38 | } while(0) |
|---|
| 39 | #else |
|---|
| 40 | # define NEW(x) x##_new |
|---|
| 41 | # define LOADSYM(x) \ |
|---|
| 42 | do { \ |
|---|
| 43 | /* Nothing to do under Windows, everything is done as soon \ |
|---|
| 44 | * as the process is launched. */ \ |
|---|
| 45 | } while(0) |
|---|
| 46 | #endif |
|---|
| 47 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.