CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/external/source/exploits/CVE-2017-13861/liboffsetfinder64/all_liboffsetfinder.hpp
Views: 11784
1
//
2
// all_liboffsetfinder.hpp
3
// liboffsetfinder64
4
//
5
// Created by tihmstar on 09.03.18.
6
// Copyright © 2018 tihmstar. All rights reserved.
7
//
8
9
#ifndef all_liboffsetfinder_h
10
#define all_liboffsetfinder_h
11
12
#ifdef DEBUG
13
#define OFFSETFINDER64_VERSION_COMMIT_COUNT "Debug"
14
#define OFFSETFINDER64_VERSION_COMMIT_SHA "Build: " __DATE__ " " __TIME__
15
16
#include <stdint.h>
17
static uint64_t BIT_RANGE(uint64_t v, int begin, int end) { return ((v)>>(begin)) % (1 << ((end)-(begin)+1)); }
18
static uint64_t BIT_AT(uint64_t v, int pos){ return (v >> pos) % 2; }
19
20
#else
21
#define BIT_RANGE(v,begin,end) ( ((v)>>(begin)) % (1 << ((end)-(begin)+1)) )
22
#define BIT_AT(v,pos) ( (v >> pos) % 2 )
23
#endif
24
25
#define info(a ...) ({printf(a),printf("\n");})
26
#define log(a ...) ({if (dbglog) printf(a),printf("\n");})
27
#define warning(a ...) ({if (dbglog) printf("[WARNING] "), printf(a),printf("\n");})
28
#define error(a ...) ({printf("[Error] "),printf(a),printf("\n");})
29
30
#define safeFree(ptr) ({if (ptr) free(ptr),ptr=NULL;})
31
32
#define reterror(err) throw tihmstar::exception(__LINE__, err, LOCAL_FILENAME)
33
#define retcustomerror(err,except) throw tihmstar::except(__LINE__, err, LOCAL_FILENAME)
34
#define assure(cond) if ((cond) == 0) throw tihmstar::exception(__LINE__, "assure failed", LOCAL_FILENAME)
35
#define doassure(cond,code) do {if (!(cond)){(code);assure(cond);}} while(0)
36
#define retassure(cond, err) if ((cond) == 0) throw tihmstar::exception(__LINE__,err,LOCAL_FILENAME)
37
#define assureclean(cond) do {if (!(cond)){clean();assure(cond);}} while(0)
38
39
40
#endif /* all_liboffsetfinder_h */
41
42