"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libhfcommon/util.h" between
honggfuzz-2.1.tar.gz and honggfuzz-2.2.tar.gz

About: honggfuzz is a security oriented, feedback-driven, evolutionary, easy-to-use fuzzer with powerful analysis options.

util.h  (honggfuzz-2.1):util.h  (honggfuzz-2.2)
skipping to change at line 69 skipping to change at line 69
#define ATOMIC_PRE_SUB(x, y) __atomic_sub_fetch(&(x), y, __ATOMIC_RELAXED) #define ATOMIC_PRE_SUB(x, y) __atomic_sub_fetch(&(x), y, __ATOMIC_RELAXED)
#define ATOMIC_POST_SUB(x, y) __atomic_fetch_sub(&(x), y, __ATOMIC_RELAXED) #define ATOMIC_POST_SUB(x, y) __atomic_fetch_sub(&(x), y, __ATOMIC_RELAXED)
#define ATOMIC_PRE_AND(x, y) __atomic_and_fetch(&(x), y, __ATOMIC_RELAXED) #define ATOMIC_PRE_AND(x, y) __atomic_and_fetch(&(x), y, __ATOMIC_RELAXED)
#define ATOMIC_POST_AND(x, y) __atomic_fetch_and(&(x), y, __ATOMIC_RELAXED) #define ATOMIC_POST_AND(x, y) __atomic_fetch_and(&(x), y, __ATOMIC_RELAXED)
#define ATOMIC_PRE_OR(x, y) __atomic_or_fetch(&(x), y, __ATOMIC_RELAXED) #define ATOMIC_PRE_OR(x, y) __atomic_or_fetch(&(x), y, __ATOMIC_RELAXED)
#define ATOMIC_POST_OR(x, y) __atomic_fetch_or(&(x), y, __ATOMIC_RELAXED) #define ATOMIC_POST_OR(x, y) __atomic_fetch_or(&(x), y, __ATOMIC_RELAXED)
#define ATOMIC_PRE_INC_RELAXED(x) __atomic_add_fetch(&(x), 1, __ATOMIC_RELAXED)
#define ATOMIC_POST_OR_RELAXED(x, y) __atomic_fetch_or(&(x), y, __ATOMIC_RELAXED
)
__attribute__((always_inline)) static inline bool ATOMIC_BITMAP_SET(uint8_t* add r, size_t offset) { __attribute__((always_inline)) static inline bool ATOMIC_BITMAP_SET(uint8_t* add r, size_t offset) {
addr += (offset / 8); addr += (offset / 8);
uint8_t mask = (1U << (offset % 8)); uint8_t mask = (1U << (offset % 8));
if (ATOMIC_GET(*addr) & mask) { if (ATOMIC_GET(*addr) & mask) {
return true; return true;
} }
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
bool old; bool old;
__asm__ __volatile__("lock bts %2, %0\n\t" __asm__ __volatile__("lock bts %2, %0\n\t"
"sbb %1, %1\n\t" "sbb %1, %1\n\t"
: "+m"(*addr), "=r"(old) : "+m"(*addr), "=r"(old)
: "Ir"(offset % 8)); : "Ir"(offset % 8));
return old; return old;
#else /* defined(__x86_64__) || defined(__i386__) */ #else /* defined(__x86_64__) || defined(__i386__) */
return (ATOMIC_POST_OR_RELAXED(*addr, mask) & mask); return (ATOMIC_POST_OR(*addr, mask) & mask);
#endif /* defined(__x86_64__) || defined(__i386__) */ #endif /* defined(__x86_64__) || defined(__i386__) */
} }
extern void* util_Malloc(size_t sz); #define HF_MAX(x, y) ((x > y) ? x : y)
#define HF_MIN(x, y) ((x < y) ? x : y)
#define HF_CAP(v, x, y) HF_MAX(x, HF_MIN(y, v))
#define util_Log2(v) ((sizeof(unsigned int) * 8) - __builtin_clz((unsigned int)v
) - 1)
typedef enum {
LHFC_ADDR_NOTFOUND = 0,
LHFC_ADDR_RO = 1,
LHFC_ADDR_RW = 2,
} lhfc_addr_t;
extern void* util_Malloc(size_t sz);
extern void* util_Calloc(size_t sz); extern void* util_Calloc(size_t sz);
extern void* util_AllocCopy(const uint8_t* ptr, size_t sz);
extern void* util_MMap(size_t sz); extern void* util_MMap(size_t sz);
extern void* util_Realloc(void* ptr, size_t sz); extern void* util_Realloc(void* ptr, size_t sz);
extern char* util_StrDup(const char* s);
extern uint64_t util_rndGet(uint64_t min, uint64_t max); extern uint64_t util_rndGet(uint64_t min, uint64_t max);
extern void util_rndBuf(uint8_t* buf, size_t sz); extern void util_rndBuf(uint8_t* buf, size_t sz);
extern void util_rndBufPrintable(uint8_t* buf, size_t sz); extern void util_rndBufPrintable(uint8_t* buf, size_t sz);
extern uint64_t util_rnd64(void); extern uint64_t util_rnd64(void);
extern uint8_t util_rndPrintable(void); extern uint8_t util_rndPrintable(void);
extern void util_turnToPrintable(uint8_t* buf, size_t sz); extern char* util_StrDup(const char* s);
extern int util_ssnprintf(char* str, size_t size, const char* format, ...) extern int util_ssnprintf(char* str, size_t size, const char* format, ...)
__attribute__((format(printf, 3, 4))); __attribute__((format(printf, 3, 4)));
extern int util_vssnprintf(char* str, size_t size, const char* format, va_list a p); extern int util_vssnprintf(char* str, size_t size, const char* format, va_list a p);
extern bool util_strStartsWith(const char* str, const char* tofind); extern bool util_strStartsWith(const char* str, const char* tofind);
extern bool util_isANumber(const char* s);
extern size_t util_decodeCString(char* s);
extern void util_getLocalTime(const char* fmt, char* buf, size_t len, time_t tm) ; extern void util_getLocalTime(const char* fmt, char* buf, size_t len, time_t tm) ;
extern const char* util_sigName(int signo);
extern void util_turnToPrintable(uint8_t* buf, size_t sz);
extern void util_closeStdio(bool close_stdin, bool close_stdout, bool close_stde rr); extern void util_closeStdio(bool close_stdin, bool close_stdout, bool close_stde rr);
extern lhfc_addr_t util_getProgAddr(const void* addr);
extern bool util_32bitValInBinary(uint32_t v);
extern bool util_64bitValInBinary(uint32_t v);
extern uint64_t util_hash(const char* buf, size_t len); extern uint64_t util_hash(const char* buf, size_t len);
extern int64_t fastArray64Search(uint64_t* array, size_t arraySz, uint64_t key);
extern int64_t util_timeNowMillis(void); extern int64_t util_timeNowUSecs(void);
extern void util_sleepForMSec(uint64_t msec); extern void util_sleepForMSec(uint64_t msec);
extern uint64_t util_getUINT32(const uint8_t* buf); extern uint64_t util_getUINT32(const uint8_t* buf);
extern uint64_t util_getUINT64(const uint8_t* buf); extern uint64_t util_getUINT64(const uint8_t* buf);
extern void util_mutexLock(pthread_mutex_t* mutex, const char* func, int line); extern void util_mutexLock(pthread_mutex_t* mutex, const char* func, int line);
extern void util_mutexUnlock(pthread_mutex_t* mutex, const char* func, int line) ; extern void util_mutexUnlock(pthread_mutex_t* mutex, const char* func, int line) ;
extern void util_mutexRWLockRead(pthread_rwlock_t* mutex, const char* func, int line); extern void util_mutexRWLockRead(pthread_rwlock_t* mutex, const char* func, int line);
extern void util_mutexRWLockWrite(pthread_rwlock_t* mutex, const char* func, int line); extern void util_mutexRWLockWrite(pthread_rwlock_t* mutex, const char* func, int line);
extern void util_mutexRWUnlock(pthread_rwlock_t* mutex, const char* func, int li ne); extern void util_mutexRWUnlock(pthread_rwlock_t* mutex, const char* func, int li ne);
extern int64_t fastArray64Search(uint64_t* array, size_t arraySz, uint64_t key);
extern bool util_isANumber(const char* s);
extern size_t util_decodeCString(char* s);
extern uint64_t util_CRC64(const uint8_t* buf, size_t len); extern uint64_t util_CRC64(const uint8_t* buf, size_t len);
extern uint64_t util_CRC64Rev(const uint8_t* buf, size_t len); extern uint64_t util_CRC64Rev(const uint8_t* buf, size_t len);
extern const char* util_sigName(int signo);
extern bool util_isAddrRO(const void* addr);
#endif /* ifndef _HF_COMMON_UTIL_H_ */ #endif /* ifndef _HF_COMMON_UTIL_H_ */
 End of changes. 21 change blocks. 
30 lines changed or deleted 26 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)