LOG_FATAL

Table of Contents

LOG_FATAL

Description

Writes a fatal log message and aborts the program. …[in] : Format string and arguments following printf-style syntax.

Success

Message logged and program aborted via abort()

Failure

Logging may fail silently, but abort() will still execute

Usage example (Cross-references)

    i32 MemCompare(const void *p1, const void *p2, size n) {
    if (!p1 || !p2) {
    LOG_FATAL("Invalid arguments");
    }
    void *MemCopy(void *dst, const void *src, size n) {
    if (!dst || !src) {
    LOG_FATAL("Invalid arguments");
    }
    void *MemMove(void *dst, const void *src, size n) {
    if (!dst || !src) {
    LOG_FATAL("Invalid arguments");
    }
    void *MemSet(void *dst, i32 val, size n) {
    if (!dst) {
    LOG_FATAL("Invalid arguments");
    }
    size ZstrLen(const char *str) {
    if (!str) {
    LOG_FATAL("Invalid arguments");
    }
    i32 ZstrCompare(const char *s1, const char *s2) {
    if (!s1 || !s2) {
    LOG_FATAL("Invalid arguments");
    }
    i32 ZstrCompareN(const char *s1, const char *s2, size n) {
    if (!s1 || !s2) {
    LOG_FATAL("Invalid arguments");
    }
    char *ZstrDupN(const char *src, size n) {
    if (!src) {
    LOG_FATAL("Invalid arguments");
    }
    bool ZstrInitClone(const char **dst, const char **src) {
    if (!dst || !src || !*src) {
    LOG_FATAL("Invalid arguments.");
    }
    void ZstrDeinit(const char **zs) {
    if (!zs) {
    LOG_FATAL("Invalid arguments");
    }
    char *ZstrFindSubstring(const char *haystack, const char *needle) {
    if (!haystack || !needle) {
    LOG_FATAL("Invalid arguments");
    }
    char *ZstrFindSubstringN(const char *haystack, const char *needle, size needle_len) {
    if (!haystack || !needle) {
    LOG_FATAL("Invalid arguments");
    }
    static bool ParseFormatSpec(const char *spec, u32 len, FmtInfo *fi) {
    if (!spec || !fi) {
    LOG_FATAL("Invalid arguments to ParseFormatSpec");
    return false;
    }
    bool StrWriteFmtInternal(Str *o, const char *fmt, TypeSpecificIO *args, u64 argc) {
    if (!o || !fmt) {
    LOG_FATAL("Invalid arguments");
    return false;
    }
    }
    #else
    LOG_FATAL("Invalid writer or data pointer");
    #endif
    }
    const char *StrReadFmtInternal(const char *input, const char *fmtstr, TypeSpecificIO *argv, u64 argc) {
    if (!input || !fmtstr) {
    LOG_FATAL("Invalid arguments");
    }
    void FReadFmtInternal(FILE *file, const char *fmtstr, TypeSpecificIO *argv, u64 argc) {
    if (!file || !fmtstr) {
    LOG_FATAL("Invalid arguments");
    }
    static inline void write_int_as_chars(Str *o, FormatFlags flags, u64 value, size num_bytes) {
    if (!o || !num_bytes || num_bytes > 8) {
    LOG_FATAL("Invalid arguments to write_int_as_chars");
    }
    static inline void write_char_internal(Str *o, FormatFlags flags, const char *vs, size len) {
    if (!o || !vs || !len) {
    LOG_FATAL("Invalid arguments");
    }
    static inline const char *read_chars_internal(const char *i, u8 *buffer, size buffer_size, FmtInfo *fmt_info) {
    if (!i || !buffer || !buffer_size) {
    LOG_FATAL("Invalid arguments to read_chars_internal");
    }
    void _write_Str(Str *o, FmtInfo *fmt_info, Str *s) {
    if (!o || !s || !fmt_info) {
    LOG_FATAL("Invalid arguments");
    }
    void _write_Zstr(Str *o, FmtInfo *fmt_info, const char **s) {
    if (!o || !s || !*s || !fmt_info) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_u64(Str *o, FmtInfo *fmt_info, u64 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_u32(Str *o, FmtInfo *fmt_info, u32 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_u16(Str *o, FmtInfo *fmt_info, u16 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_u8(Str *o, FmtInfo *fmt_info, u8 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_i64(Str *o, FmtInfo *fmt_info, i64 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_i32(Str *o, FmtInfo *fmt_info, i32 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_i16(Str *o, FmtInfo *fmt_info, i16 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_i8(Str *o, FmtInfo *fmt_info, i8 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_f64(Str *o, FmtInfo *fmt_info, f64 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    void _write_f32(Str *o, FmtInfo *fmt_info, f32 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    const char *_read_Str(const char *i, FmtInfo *fmt_info, Str *s) {
    if (!i || !s)
    LOG_FATAL("Invalid arguments");
    
    ValidateStr(s);
    const char *_read_f64(const char *i, FmtInfo *fmt_info, f64 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_u8(const char *i, FmtInfo *fmt_info, u8 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Skip whitespace
    const char *_read_u16(const char *i, FmtInfo *fmt_info, u16 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_u32(const char *i, FmtInfo *fmt_info, u32 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_u64(const char *i, FmtInfo *fmt_info, u64 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_i8(const char *i, FmtInfo *fmt_info, i8 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_i16(const char *i, FmtInfo *fmt_info, i16 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_i32(const char *i, FmtInfo *fmt_info, i32 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    const char *_read_i64(const char *i, FmtInfo *fmt_info, i64 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    (void)fmt_info; // Unused parameter
    if (!i || !out)
    LOG_FATAL("Invalid arguments");
    
    // For string types, :c has no effect - work like regular string reading
    void _write_BitVec(Str *o, FmtInfo *fmt_info, BitVec *bv) {
    if (!o || !fmt_info || !bv) {
    LOG_FATAL("Invalid arguments");
    return;
    }
    (void)fmt_info;
    (void)s;
    LOG_FATAL("Attempt to write unsupported type");
    }
    (void)fmt_info; // Unused parameter
    if (!i || !bv) {
    LOG_FATAL("Invalid arguments");
    return i;
    }
    (void)fmt_info; // Unused parameter
    (void)s;
    LOG_FATAL("Attempt to read unsupported type.");
    return i;
    }
    const char *_read_f32(const char *i, FmtInfo *fmt_info, f32 *v) {
    if (!i || !v)
    LOG_FATAL("Invalid arguments");
    
    // Handle character format specifier
    static void _write_r8(Str *o, FmtInfo *fmt_info, u8 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    }
    static void _write_r16(Str *o, FmtInfo *fmt_info, u16 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    }
    case ENDIAN_NATIVE :
    default : {
    LOG_FATAL("Invalid endianness provided. Unexpected code reached.");
    }
    }
    static void _write_r32(Str *o, FmtInfo *fmt_info, u32 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    }
    case ENDIAN_NATIVE :
    default : {
    LOG_FATAL("Invalid endianness provided. Unexpected code reached.");
    }
    }
    static void _write_r64(Str *o, FmtInfo *fmt_info, u64 *v) {
    if (!o || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    }
    case ENDIAN_NATIVE :
    default : {
    LOG_FATAL("Invalid endianness provided. Unexpected code reached.");
    }
    }
    static const char *_read_r8(const char *i, FmtInfo *fmt_info, u8 *v) {
    if (!i || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments");
    }
    static const char *_read_r16(const char *i, FmtInfo *fmt_info, u16 *v) {
    if (!i || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments to _read_r16");
    }
    case ENDIAN_NATIVE :
    default :
    LOG_FATAL("Invalid endianness provided. Unexpected code reached in _read_r16.");
    }
    static const char *_read_r32(const char *i, FmtInfo *fmt_info, u32 *v) {
    if (!i || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments to _read_r32");
    }
    case ENDIAN_NATIVE :
    default :
    LOG_FATAL("Invalid endianness provided. Unexpected code reached in _read_r32.");
    }
    static const char *_read_r64(const char *i, FmtInfo *fmt_info, u64 *v) {
    if (!i || !fmt_info || !v) {
    LOG_FATAL("Invalid arguments to _read_r64");
    }
    case ENDIAN_NATIVE :
    default :
    LOG_FATAL("Invalid endianness provided. Unexpected code reached in _read_r64.");
    }
    }
    } else {
    LOG_FATAL("Invalid direction");
    return 0;
    }
    void validate_iter(GenericIter *i) {
    if (((i)->dir != -1 && (i)->dir != 1) || !(i)->alignment || !(i)->length || (i)->pos >= (i)->length) {
    LOG_FATAL("Invalid iter object.");
    }
    (void)(*(char *)(void *)((i)->data));
    
    if (!new_data) {
    LOG_FATAL("Failed to allocate memory for bitvec");
    return;
    }
    ValidateBitVec(bitvec);
    if (idx >= bitvec->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
    }
    u64 byte_idx   = BIT_INDEX(idx);
    ValidateBitVec(bitvec);
    if (idx >= bitvec->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
    }
    u64 byte_idx   = BIT_INDEX(idx);
    ValidateBitVec(bitvec);
    if (idx >= bitvec->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
    }
    u64 byte_idx   = BIT_INDEX(idx);
    ValidateBitVec(bitvec);
    if (bitvec->length == 0) {
    LOG_FATAL("Cannot pop from empty bitvector");
    }
    bool value = BitVecGet(bitvec, bitvec->length - 1);
    ValidateBitVec(bitvec);
    if (idx > bitvec->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bitvec->length);
    }
    // For now, implement as push + manual bit shifting (simple but not efficient)
    ValidateBitVec(bv);
    if (idx > bv->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
    }
    if (count == 0) {
    ValidateBitVec(other);
    if (idx > bv->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
    }
    if (other->length == 0) {
    ValidateBitVec(bv);
    if (idx > bv->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
    }
    if (pattern_bits == 0 || pattern_bits > 8) {
    ValidateBitVec(bv);
    if (idx >= bv->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
    }
    ValidateBitVec(bv);
    if (idx >= bv->length) {
    LOG_FATAL("Index {} exceeds bitvector length {}", idx, bv->length);
    }
    if (count == 0) {
    
    if (start1 + len > bv1->length) {
    LOG_FATAL("Range [{}:{}] exceeds bitvector1 length {}", start1, LVAL(start1 + len - 1), bv1->length);
    }
    if (start2 + len > bv2->length) {
    }
    if (start2 + len > bv2->length) {
    LOG_FATAL("Range [{}:{}] exceeds bitvector2 length {}", start2, LVAL(start2 + len - 1), bv2->length);
    }
    
    if (start1 + len > bv1->length) {
    LOG_FATAL("Range [{}:{}] exceeds bitvector1 length {}", start1, LVAL(start1 + len - 1), bv1->length);
    }
    if (start2 + len > bv2->length) {
    }
    if (start2 + len > bv2->length) {
    LOG_FATAL("Range [{}:{}] exceeds bitvector2 length {}", start2, LVAL(start2 + len - 1), bv2->length);
    }
    BitVec BitVecFromStr(const char *str) {
    if (!str) {
    LOG_FATAL("str is NULL");
    }
    ValidateBitVec(bv);
    if (!bytes) {
    LOG_FATAL("bytes is NULL");
    }
    if (max_len == 0) {
    }
    if (max_len == 0) {
    LOG_FATAL("max_len is 0");
    }
    if (bv->length == 0) {
    BitVec BitVecFromBytes(const u8 *bytes, u64 bit_len) {
    if (!bytes) {
    LOG_FATAL("bytes is NULL");
    }
    
    if (!results || max_results == 0) {
    LOG_FATAL("results is NULL or max_results is 0");
    }
    ValidateBitVec(bv);
    if (!runs || !values || max_runs == 0) {
    LOG_FATAL("invalid arguments");
    }
    FREE(prev_row);
    FREE(curr_row);
    LOG_FATAL("Memory allocation failed");
    }
    ValidateBitVec(bv);
    if (!pattern) {
    LOG_FATAL("pattern is NULL");
    }
    ValidateBitVec(bv);
    if (!patterns) {
    LOG_FATAL("invalid BitVecs object provided");
    }
    ValidateBitVec(bv);
    if (!patterns) {
    LOG_FATAL("invalid arguments");
    }
    void ValidateBitVec(const BitVec *bv) {
    if (!(bv)) {
    LOG_FATAL("Invalid bitvec object: NULL.");
    }
    if ((bv)->__magic != MISRA_BITVEC_MAGIC) {
    }
    if ((bv)->__magic != MISRA_BITVEC_MAGIC) {
    LOG_FATAL("Invalid bitvec. Either uninitialized or curropted!");
    }
    if ((bv)->length > (bv)->capacity) {
    }
    if ((bv)->length > (bv)->capacity) {
    LOG_FATAL("Invalid bitvec object: length > capacity.");
    }
    if ((bv)->length > 0 && !(bv)->data) {
    }
    if ((bv)->length > 0 && !(bv)->data) {
    LOG_FATAL("Invalid bitvec object: length > 0 but data is NULL.");
    }
    if ((bv)->capacity > 0 && (bv)->byte_size * 8 < (bv)->capacity) {
    }
    if ((bv)->capacity > 0 && (bv)->byte_size * 8 < (bv)->capacity) {
    LOG_FATAL("Invalid bitvec object: byte_u64 too small for capacity.");
    }
    if ((bv)->data) {
    void insert_into_list(GenericList *list, void *item_data, u64 item_size, u64 idx) {
    if (!list || !item_size || !item_data) {
    LOG_FATAL("invalid arguments.");
    }
    }
    } else {
    LOG_FATAL("list index out of range.");
    }
    void remove_range_list(GenericList *list, void *removed_data, u64 item_size, u64 start, u64 count) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    
    if (start + count > list->length) {
    LOG_FATAL("List range out of bounds.");
    }
    void qsort_list(GenericList *list, u64 item_size, GenericCompare comp) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    void swap_list(GenericList *list, u64 item_size, u64 idx1, u64 idx2) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    GenericListNode *n1 = node_at_list(list, item_size, idx1);
    if (!n1) {
    LOG_FATAL("failed to get node at specified index");
    }
    GenericListNode *n2 = node_at_list(list, item_size, idx2);
    if (!n2) {
    LOG_FATAL("failed to get node at specified index");
    }
    void reverse_list(GenericList *list, u64 item_size) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    void push_arr_list(GenericList *list, u64 item_size, void *arr, u64 count) {
    if (!list || !arr || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    
    if (!new_tail) {
    LOG_FATAL("Failed to allocate memory for new node");
    }
    if (!new_tail->data) {
    free(new_tail);
    LOG_FATAL("Failed to allocate memory for node data");
    }
    void merge_list(GenericList *list1, u64 item_size, GenericList *list2) {
    if (!list1 || !item_size || !list2) {
    LOG_FATAL("invalid arguments.");
    }
    void clear_list(GenericList *list, u64 item_size) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    GenericListNode *node_at_list(GenericList *list, u64 item_size, u64 idx) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    
    if (idx >= list->length) {
    LOG_FATAL("list index out of range.");
    }
    void *item_ptr_at_list(GenericList *list, u64 item_size, u64 idx) {
    if (!list || !item_size) {
    LOG_FATAL("invalid arguments.");
    }
    
    if (idx >= list->length) {
    LOG_FATAL("list index out of bounds.");
    }
    void validate_list(const GenericList *l) {
    if (!(l)) {
    LOG_FATAL("List pointer is NULL.");
    }
    if ((l)->__magic != MISRA_LIST_MAGIC) {
    }
    if ((l)->__magic != MISRA_LIST_MAGIC) {
    LOG_FATAL("Invalid list. Either not initialized or corrupted!");
    }
    if ((l)->length > 0) {
    if ((l)->length > 0) {
    if (!(l)->head) {
    LOG_FATAL("Non-empty list has NULL head.");
    }
    if (!(l)->tail) {
    }
    if (!(l)->tail) {
    LOG_FATAL("Non-empty list has NULL tail.");
    }
    }
    GenericListNode *get_node_relative_to_list_node(GenericListNode *node, i64 ridx) {
    if (!node) {
    LOG_FATAL("Invalid arguments");
    }
    GenericListNode *get_node_random_access(GenericList *list, GenericListNode *node, u64 nidx, i64 ridx) {
    if (!list || !node) {
    LOG_FATAL("Invalid arguments");
    }
    
    if (nidx >= list->length) {
    LOG_FATAL("Node index exceeds list bounds");
    }
    
    if ((ridx < 0 && (u64)(-ridx) > nidx) || (ridx > 0 && nidx + (u64)ridx >= list->length)) {
    LOG_FATAL("Relative node index outside of list bounds");
    }
    
    if (!v->alignment) {
    LOG_FATAL("Invalid alignment. Did you initialize before use? Aborting...");
    }
    
    if (idx > vec->length) {
    LOG_FATAL("vector index out of bounds, insertion at index greater than length");
    }
    
    if (idx > vec->length) {
    LOG_FATAL("vector index out of bounds, insertion at index greater than length");
    }
    
    if (start + count > vec->length) {
    LOG_FATAL("vector range out of bounds.");
    }
    
    if (start + count > vec->length) {
    LOG_FATAL("vector range out of bounds.");
    }
    
    if (vec_aligned_size(vec, item_size) != item_size) {
    LOG_FATAL(
    "QSort not implemented for vectors wherein the size of items don't "
    "match their aligned size."
    
    if (idx1 >= vec->length || idx2 >= vec->length) {
    LOG_FATAL("vector index out of bounds.");
    }
    void validate_vec(const GenericVec *v) {
    if (!(v)) {
    LOG_FATAL("NULL vec object pointer.");
    }
    if ((v)->__magic != MISRA_VEC_MAGIC) {
    }
    if ((v)->__magic != MISRA_VEC_MAGIC) {
    LOG_FATAL("Invalid vec object. Either uninitialized or corrupted!");
    }
    if (!(v)->alignment || (v)->length > (v)->capacity) {
    }
    if (!(v)->alignment || (v)->length > (v)->capacity) {
    LOG_FATAL("Invalid vec object.");
    }
    // if memory is invalid, system will segfault here
    SysDirEntry *SysDirEntryInitCopy(SysDirEntry *dst, SysDirEntry *src) {
    if (!dst || !src) {
    LOG_FATAL("invalid arguments.");
    }
    SysDirEntry *SysDirEntryDeinitCopy(SysDirEntry *copy) {
    if (!copy) {
    LOG_FATAL("invalid arguments.");
    }
    SysDirContents SysGetDirContents(const char *path) {
    if (!path) {
    LOG_FATAL("Invalid argument");
    }
    SysDirContents SysGetDirContents(const char *path) {
    if (!path) {
    LOG_FATAL("invalid arguments.");
    }
    void SysProcWait(SysProc *proc) {
    if (!proc) {
    LOG_FATAL("Invalid argument");
    }
    SysProcStatus SysProcWaitFor(SysProc *proc, u64 timeout_ms) {
    if (!proc) {
    LOG_FATAL("Invalid arguments");
    }
    void SysProcTerminate(SysProc *proc) {
    if (!proc) {
    LOG_FATAL("Invalid argument");
    }
    void SysProcDestroy(SysProc *proc) {
    if (!proc) {
    LOG_FATAL("Invalid argument");
    }
    SysProcTerminate(proc);
    i32 SysProcWriteToStdin(SysProc *proc, Str *buf) {
    if (!proc || !buf) {
    LOG_FATAL("Invalid arguments");
    }
    i32 sys_proc_read_internal(SysProc *proc, Str *buf, bool is_stdout) {
    if (!proc || !buf) {
    LOG_FATAL("Invalid argument");
    }
    i32 SysProcGetId(SysProc *proc) {
    if (!proc) {
    LOG_FATAL("Invalid argument");
    }
    i32 SysProcIsRunning(SysProc *proc) {
    if (!proc) {
    LOG_FATAL("Invalid argument");
    }
    i32 SysProcGetExitCode(SysProc *proc) {
    if (!proc) {
    LOG_FATAL("Invalid argument");
    }
    Str *SysGetCurrentExecutablePath(Str *exe_path) {
    if (!exe_path) {
    LOG_FATAL("Invalid arguments: exe_path is NULL");
    }
    BitVecPush(&pattern, true);
    
    BitVecFindPattern(NULL, &pattern); // Should cause LOG_FATAL
    
    BitVecDeinit(&pattern);
    BitVecPush(&source, false);
    
    BitVecFindPattern(&source, NULL); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindLastPattern(NULL, &pattern); // Should cause LOG_FATAL
    
    BitVecDeinit(&pattern);
    BitVecPush(&source, false);
    
    BitVecFindLastPattern(&source, NULL); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    
    // Don't create pattern BitVec since we're testing NULL source validation
    BitVecFindAllPattern(NULL, (BitVec *)0x1, results, 10); // Should cause LOG_FATAL
    
    return true;
    BitVecPush(&source, false);
    
    BitVecFindAllPattern(&source, NULL, results, 10); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindAllPattern(&source, &pattern, NULL, 10); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindAllPattern(&source, &pattern, results, 0); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindPattern(NULL, &pattern); // Should cause LOG_FATAL
    
    BitVecDeinit(&pattern);
    BitVecPush(&source, false);
    
    BitVecFindPattern(&source, NULL); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindLastPattern(NULL, &pattern); // Should cause LOG_FATAL
    
    BitVecDeinit(&pattern);
    BitVecPush(&source, false);
    
    BitVecFindLastPattern(&source, NULL); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    
    // Don't create pattern BitVec since we're testing NULL source validation
    BitVecFindAllPattern(NULL, (BitVec *)0x1, results, 10); // Should cause LOG_FATAL
    
    return true;
    BitVecPush(&source, false);
    
    BitVecFindAllPattern(&source, NULL, results, 10); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindAllPattern(&source, &pattern, NULL, 10); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    BitVecPush(&pattern, true);
    
    BitVecFindAllPattern(&source, &pattern, results, 0); // Should cause LOG_FATAL
    
    BitVecDeinit(&source);
    int main(int argc, char **argv) {
    if (argc < 2) {
    LOG_FATAL("USAGE: {} {}", argv[0], argv[1]);
    }
    // for an invalid elf magic, any subsequent fields will be zero, and hence will be invalid
    if (eh.meta.class != ELF_CLASS_64) {
    LOG_FATAL("Only 64-bit binaries supported for now. Class for provided binary is = {}", eh.meta.class);
    }
    Scope(&config, StrDeinit, {
    if (!ReadCompleteFile(config_path, &config.data, &config.length, &config.capacity)) {
    LOG_FATAL("Failed to read config file.");
    }
    StrIter json = StrIterFromStr(config);
    {                                                                                                              \
    if (varr == NULL) {                                                                                        \
    LOG_FATAL("Expected a valid pointer");                                                                 \
    }                                                                                                          \
    VEC_DATATYPE(v) __tmp_val_##__LINE__ = *(varr);                                                            \
    {                                                                                                              \
    if (varr == NULL) {                                                                                        \
    LOG_FATAL("Expected a valid pointer");                                                                 \
    }                                                                                                          \
    VEC_DATATYPE(v) __tmp_val_##__LINE__ = *(varr);                                                            \
    {                                                                                                              \
    if (varr == NULL) {                                                                                        \
    LOG_FATAL("Expected a valid pointer");                                                                 \
    }                                                                                                          \
    VEC_DATATYPE(v) __tmp_val_##__LINE__ = *(varr);                                                            \
    {                                                                                                              \
    if (varr == NULL) {                                                                                        \
    LOG_FATAL("Expected a valid pointer");                                                                 \
    }                                                                                                          \
    VEC_DATATYPE(v) __tmp_val_##__LINE__ = *(varr);                                                            \

Share :

Related Posts

JW_FLT_KV

JW_FLT_KV Description Write a key and float value to a JSON object.

Read More

JW_INT_KV

JW_INT_KV Description Write a key and integer value to a JSON object.

Read More

JW_BOOL_KV

JW_BOOL_KV Description Write a key and boolean value into a JSON object.

Read More