static inline size_t
small_round(size_t size)
{
	if (size < 2)
		return size;
	assert(size <= SIZE_MAX / 2 + 1);
	assert(size - 1 <= ULONG_MAX);
	size_t r = 1;
	return r << (sizeof(unsigned long) * CHAR_BIT -
		     __builtin_clzl((unsigned long) (size - 1)));
}


void http_parser_create(struct http_parser *parser)
{
 parser->hdr_value_start = NULL;
 parser->hdr_value_end = NULL;
 parser->http_major = -1;
 parser->http_minor = -1;
 parser->hdr_name = NULL;
 parser->hdr_name_idx = 0;
}

0x8c48348707e8b49 <error: Cannot access memory at address 0x8c48348707e8b49>

0x634c1e95e415b <error: Cannot access memory at address 0x634c1e95e415b>

0x48000664c2058d48 <error: Cannot access memory at address 0x48000664c2058d48>


ssize_t
datetime_parse_full(struct datetime *date, const char *str, size_t len,
		    const char *tzsuffix, int32_t offset)
{
	size_t n;
	dt_t dt;
	const char *svp = str;
	char c;
	int sec_of_day = 0, nanosecond = 0;
	int16_t tzindex = 0;

	n = dt_parse_iso_date(str, len, &dt);
	if (n == 0)
		return 0;

	str += n;
	len -= n;
	if (len <= 0)
		goto exit;

	c = *str++;
	if (c != 'T' && c != 't' && c != ' ')
		return 0;
	len--;
	if (len <= 0)
		goto exit;

	n = dt_parse_iso_time(str, len, &sec_of_day, &nanosecond);
	if (n == 0)
		return 0;

	str += n;
	len -= n;
	if (len <= 0)
		goto exit;

	time_t base = dt_epoch(dt) + sec_of_day - offset * 60;
	ssize_t l;
	if (tzsuffix != NULL) {
		l = parse_tz_suffix(tzsuffix, strlen(tzsuffix), base,
				    &tzindex, &offset);
		if (l < 0)
			return l;
		goto exit;
	}

	if (*str == ' ') {
		str++;
		len--;
	}
	if (len <= 0)
		goto exit;

	l = parse_tz_suffix(str, len, base, &tzindex, &offset);
	if (l < 0)
		return l;
	str += l;

exit:
	date->epoch = dt_epoch(dt) + sec_of_day - offset * 60;
	date->nsec = nanosecond;
	date->tzoffset = offset;
	date->tzindex = tzindex;

	return str - svp;
}


int
pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args)
{
	PrintfTarget target;
	char		onebyte[1];

	if (count == 0)
	{
		str = onebyte;
		count = 1;
	}
	target.bufstart = target.bufptr = str;
	target.bufend = str + count - 1;
	target.stream = NULL;
	target.nchars = 0;
	target.failed = false;
	dopr(&target, fmt, args);
	*(target.bufptr) = '\0';
	return target.failed ? -1 : (target.bufptr - target.bufstart
								 + target.nchars);
}


static void process_wtmp_file(const struct last_control *ctl,
			      const char *filename)
{
	FILE *fp;

	struct utmpx ut;
	struct utmplist *ulist = NULL;
	struct utmplist *p;
	struct utmplist *next;

	time_t lastboot = 0;
	time_t lastrch = 0;
	time_t lastdown;
	time_t begintime;
	int whydown = 0;

	int c, x;
	struct stat st;
	int quit = 0;
	int down = 0;

#ifndef FUZZ_TARGET
	time(&lastdown);
#else
	lastdown = 1596001948;
#endif

	lastdate = currentdate = lastrch = lastdown;

#ifndef FUZZ_TARGET

	signal(SIGINT, int_handler);
	signal(SIGQUIT, quit_handler);
#endif

	if ((fp = fopen(filename, "r")) == NULL)
		err(EXIT_FAILURE, _("cannot open %s"), filename);

	setvbuf(fp, NULL, _IOFBF, UCHUNKSIZE);

	if (uread(fp, &ut, NULL, filename) == 1)
		begintime = ut.ut_tv.tv_sec;
	else {
		if (fstat(fileno(fp), &st) != 0)
			err(EXIT_FAILURE, _("stat of %s failed"), filename);
		begintime = st.st_ctime;
		quit = 1;
	}

	uread(fp, NULL, NULL, filename);

	while (!quit) {

		if (uread(fp, &ut, &quit, filename) != 1)
			break;

		if (ctl->since && ut.ut_tv.tv_sec < ctl->since)
			continue;

		if (ctl->until && ctl->until < ut.ut_tv.tv_sec)
			continue;

		lastdate = ut.ut_tv.tv_sec;

		if (ctl->lastb) {
			quit = list(ctl, &ut, ut.ut_tv.tv_sec, R_NORMAL);
			continue;
		}

		if (strncmp(ut.ut_line, "~", 1) == 0) {
			if (strncmp(ut.ut_user, "shutdown", 8) == 0)
				ut.ut_type = SHUTDOWN_TIME;
			else if (strncmp(ut.ut_user, "reboot", 6) == 0)
				ut.ut_type = BOOT_TIME;
			else if (strncmp(ut.ut_user, "runlevel", 8) == 0)
				ut.ut_type = RUN_LVL;
		}
#if 1

		else {
			if (ut.ut_type != DEAD_PROCESS &&
			    ut.ut_user[0] && ut.ut_line[0] &&
			    strncmp(ut.ut_user, "LOGIN", 5) != 0)
				ut.ut_type = USER_PROCESS;

			if (ut.ut_user[0] == 0)
				ut.ut_type = DEAD_PROCESS;

			if (strncmp(ut.ut_user, "date", 4) == 0) {
				if (ut.ut_line[0] == '|')
					ut.ut_type = OLD_TIME;
				if (ut.ut_line[0] == '{')
					ut.ut_type = NEW_TIME;
			}
		}
#endif
		switch (ut.ut_type) {
		case SHUTDOWN_TIME:
			if (ctl->extended) {
				strcpy(ut.ut_line, "system down");
				quit = list(ctl, &ut, lastboot, R_NORMAL);
			}
			lastdown = lastrch = ut.ut_tv.tv_sec;
			down = 1;
			break;
		case OLD_TIME:
		case NEW_TIME:
			if (ctl->extended) {
				strcpy(ut.ut_line,
				ut.ut_type == NEW_TIME ? "new time" :
					"old time");
				quit = list(ctl, &ut, lastdown, R_TIMECHANGE);
			}
			break;
		case BOOT_TIME:
			strcpy(ut.ut_line, "system boot");
			if (lastdown > lastboot && lastdown != currentdate)
				quit = list(ctl, &ut, lastboot, R_REBOOT_CRASH);
			else
				quit = list(ctl, &ut, lastdown, R_REBOOT);
			lastboot = ut.ut_tv.tv_sec;
			down = 1;
			break;
		case RUN_LVL:
			x = ut.ut_pid & 255;
			if (ctl->extended) {
				snprintf(ut.ut_line, sizeof(ut.ut_line), "(to lvl %c)", x);
				quit = list(ctl, &ut, lastrch, R_NORMAL);
			}
			if (x == '0' || x == '6') {
				lastdown = ut.ut_tv.tv_sec;
				down = 1;
				ut.ut_type = SHUTDOWN_TIME;
			}
			lastrch = ut.ut_tv.tv_sec;
			break;

		case USER_PROCESS:

			c = 0;
			for (p = ulist; p; p = next) {
				next = p->next;
				if (strncmp(p->ut.ut_line, ut.ut_line,
				    sizeof(ut.ut_line)) == 0) {

					if (c == 0) {
						quit = list(ctl, &ut, p->ut.ut_tv.tv_sec, R_NORMAL);
						c = 1;
					}
					if (p->next)
						p->next->prev = p->prev;
					if (p->prev)
						p->prev->next = p->next;
					else
						ulist = p->next;
					free(p);
				}
			}

			if (c == 0) {
				if (!lastboot) {
					c = R_NOW;

					if (is_phantom(ctl, &ut))
						c = R_PHANTOM;
				} else
					c = whydown;
				quit = list(ctl, &ut, lastboot, c);
			}

		case DEAD_PROCESS:

			if (ut.ut_line[0] == 0)
				break;
			p = xmalloc(sizeof(struct utmplist));
			memcpy(&p->ut, &ut, sizeof(struct utmpx));
			p->next  = ulist;
			p->prev  = NULL;
			if (ulist)
				ulist->prev = p;
			ulist = p;
			break;

		case EMPTY:
		case INIT_PROCESS:
		case LOGIN_PROCESS:
#ifdef ACCOUNTING
		case ACCOUNTING:
#endif

			break;

		default:
			warnx("unrecognized ut_type: %d", ut.ut_type);
		}

		if (down) {
			lastboot = ut.ut_tv.tv_sec;
			whydown = (ut.ut_type == SHUTDOWN_TIME) ? R_DOWN : R_CRASH;
			for (p = ulist; p; p = next) {
				next = p->next;
				free(p);
			}
			ulist = NULL;
			down = 0;
		}
	}

	if (ctl->time_fmt != LAST_TIMEFTM_NONE) {
		struct last_timefmt *fmt;
		char timestr[LAST_TIMESTAMP_LEN];
		char *tmp = xstrdup(filename);

		fmt = &timefmts[ctl->time_fmt];
		if (time_formatter(fmt->in_fmt, timestr,
				   sizeof(timestr), &begintime) < 0)
			errx(EXIT_FAILURE, _("preallocation size exceeded"));
		printf(_("\n%s begins %s\n"), basename(tmp), timestr);
		free(tmp);
	}

	fclose(fp);

	for (p = ulist; p; p = next) {
		next = p->next;
		free(p);
	}
}

time_t lastboot = 0;	/* Last boottime */


static int process_file(const char *name)
{
    int rc = -1;
    blkid_probe pr = blkid_new_probe_from_filename(name);
    if (pr != NULL) {
        blkid_probe_enable_partitions(pr, TRUE);
        blkid_probe_set_partitions_flags(pr, FALSE);
        blkid_probe_enable_superblocks(pr, TRUE);
        blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_DEFAULT | BLKID_SUBLKS_FSINFO | BLKID_SUBLKS_MAGIC | BLKID_SUBLKS_VERSION | BLKID_SUBLKS_BADCSUM);
        rc = blkid_do_safeprobe(pr) == -1 ? -1 : 0;
    }
    blkid_free_probe(pr);
    return rc;
}


int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filename)
{
	int rc = -1;
	int flags = 0;
	pid_t tid = -1;
	struct libmnt_parser pa = { .line = 0 };

	assert(tb);
	assert(f);
	assert(filename);

	DBG(TAB, ul_debugobj(tb, "%s: start parsing [entries=%d, filter=%s]",
				filename, mnt_table_get_nents(tb),
				tb->fltrcb ? "yes" : "not"));

	pa.filename = filename;
	pa.f = f;

	if (tb->fmt == MNT_FMT_SWAPS)
		flags = MNT_FS_SWAP;
	else if (filename && strcmp(filename, _PATH_PROC_MOUNTS) == 0)
		flags = MNT_FS_KERNEL;

	do {
		struct libmnt_fs *fs;

		if (feof(f)) {
			DBG(TAB, ul_debugobj(tb, "end-of-file"));
			break;
		}
		fs = mnt_new_fs();
		if (!fs)
			goto err;

		rc = mnt_table_parse_next(&pa, tb, fs);

		if (rc == 0 && tb->fltrcb && tb->fltrcb(fs, tb->fltrcb_data))
			rc = 1;

		if (rc == 0 && mnt_table_is_noautofs(tb)) {
			const char *fstype = mnt_fs_get_fstype(fs);

			if (fstype && strcmp(fstype, "autofs") == 0 &&
			    mnt_fs_get_option(fs, "ignore", NULL, NULL) == 0)
				rc = 1;
		}

		if (rc == 0) {
			rc = mnt_table_add_fs(tb, fs);
			fs->flags |= flags;

			if (rc == 0 && tb->fmt == MNT_FMT_MOUNTINFO) {
				rc = kernel_fs_postparse(&pa, tb, fs, &tid);
				if (rc)
					mnt_table_remove_fs(tb, fs);
			}
		}

		mnt_unref_fs(fs);

		if (rc > 0) {
			DBG(TAB, ul_debugobj(tb, "recoverable error (continue)"));
			continue;
		}

		if (rc < 0 && !feof(f)) {
			DBG(TAB, ul_debugobj(tb, "fatal error"));
			goto err;
		}
	} while (1);

	DBG(TAB, ul_debugobj(tb, "%s: stop parsing (%d entries)",
				filename, mnt_table_get_nents(tb)));
	parser_cleanup(&pa);
	return 0;
err:
	DBG(TAB, ul_debugobj(tb, "%s: parse error (rc=%d)", filename, rc));
	parser_cleanup(&pa);
	return rc;
}


APR_DECLARE(apr_status_t) apr_pool_initialize(void)
{
    apr_status_t rv;
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
    char *logpath;
    apr_file_t *debug_log = NULL;
#endif

    if (apr_pools_initialized++)
        return APR_SUCCESS;

#if defined(_SC_PAGESIZE)
    boundary_size = sysconf(_SC_PAGESIZE);
#elif defined(WIN32)
    {
        SYSTEM_INFO si;
        GetSystemInfo(&si);
        boundary_size = si.dwPageSize;
    }
#endif
    boundary_index = 12;
    while ( (1 << boundary_index) < boundary_size)
        boundary_index++;
    boundary_size = (1 << boundary_index);

    if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL,
                                 NULL)) != APR_SUCCESS) {
        return rv;
    }

    apr_pool_tag(global_pool, "APR global pool");

    apr_pools_initialized = 1;

    if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
        return rv;
    }

#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
    rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool);

    if (rv == APR_SUCCESS) {
        apr_file_open(&debug_log, logpath,
                      APR_FOPEN_APPEND|APR_FOPEN_WRITE|APR_FOPEN_CREATE,
                      APR_FPROT_OS_DEFAULT, global_pool);
    }
    else {
        apr_file_open_stderr(&debug_log, global_pool);
    }

    file_stderr = debug_log;

    if (file_stderr) {
        apr_file_printf(file_stderr,
            "POOL DEBUG: [PID"
#if APR_HAS_THREADS
            "/TID"
#endif
            "] ACTION  (SIZE      /POOL SIZE /TOTAL SIZE) "
            "POOL       \"TAG\" <__FILE__:__LINE__> PARENT     (ALLOCS/TOTAL ALLOCS/CLEARS)\n");

        apr_pool_log_event(global_pool, "GLOBAL", __FILE__ ":apr_pool_initialize", 0);

        apr_pool_cleanup_register(global_pool, NULL,
                                  apr_pool_cleanup_file_stderr,
                                  apr_pool_cleanup_null);
    }
#endif

    return APR_SUCCESS;
}


void af_gb_init() {
  pointer_idx = 0;

   for (int i = 0; i < GB_SIZE; i++) {
     pointer_arr[i] = NULL;
   }
}


APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str,
                                            char ***argv_out,
                                            apr_pool_t *token_context)
{
    const char *cp;
    const char *ct;
    char *cleaned, *dirty;
    int escaped;
    int isquoted, numargs = 0, argnum;

#define SKIP_WHITESPACE(cp) \
    for ( ; *cp == ' ' || *cp == '\t'; ) { \
        cp++; \
    };

#define CHECK_QUOTATION(cp,isquoted) \
    isquoted = 0; \
    if (*cp == '"') { \
        isquoted = 1; \
        cp++; \
    } \
    else if (*cp == '\'') { \
        isquoted = 2; \
        cp++; \
    }

#define DETERMINE_NEXTSTRING(cp,isquoted) \
    for ( ; *cp != '\0'; cp++) { \
        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
            cp++; \
            continue; \
        } \
        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
            || (isquoted == 1 && *cp == '"') \
            || (isquoted == 2 && *cp == '\'')                 ) { \
            break; \
        } \
    }

#define REMOVE_ESCAPE_CHARS(cleaned, dirty, escaped) \
    escaped = 0; \
    while(*dirty) { \
        if (!escaped && *dirty == '\\') { \
            escaped = 1; \
        } \
        else { \
            escaped = 0; \
            *cleaned++ = *dirty; \
        } \
        ++dirty; \
    } \
    *cleaned = 0;

    cp = arg_str;
    SKIP_WHITESPACE(cp);
    ct = cp;

    numargs = 1;
    while (*ct != '\0') {
        CHECK_QUOTATION(ct, isquoted);
        DETERMINE_NEXTSTRING(ct, isquoted);
        if (*ct != '\0') {
            ct++;
        }
        numargs++;
        SKIP_WHITESPACE(ct);
    }
    *argv_out = apr_palloc(token_context, numargs * sizeof(char*));

    for (argnum = 0; argnum < (numargs-1); argnum++) {
        SKIP_WHITESPACE(cp);
        CHECK_QUOTATION(cp, isquoted);
        ct = cp;
        DETERMINE_NEXTSTRING(cp, isquoted);
        cp++;
        (*argv_out)[argnum] = apr_palloc(token_context, cp - ct);
        apr_cpystrn((*argv_out)[argnum], ct, cp - ct);
        cleaned = dirty = (*argv_out)[argnum];
        REMOVE_ESCAPE_CHARS(cleaned, dirty, escaped);
    }
    (*argv_out)[argnum] = NULL;

    return APR_SUCCESS;
}


nxt_int_t
nxt_lib_start(const char *app, char **argv, char ***envp)
{
    int           n;
    nxt_int_t     flags;
    nxt_bool_t    update;
    nxt_thread_t  *thread;

    flags = nxt_stderr_start();

    nxt_log_start(app);

    nxt_pid = getpid();
    nxt_ppid = getppid();
    nxt_euid = geteuid();
    nxt_egid = getegid();

#if (NXT_DEBUG)

    nxt_main_log.level = NXT_LOG_DEBUG;

#if (NXT_HAVE_MALLOPT)

    mallopt(M_PERTURB, 0x55);
#endif

#if (NXT_MACOSX)

    setenv("MallocScribble", "1", 0);
#endif

#endif

    nxt_thread_init_data(nxt_thread_context);
    thread = nxt_thread();
    thread->log = &nxt_main_log;

    thread->handle = nxt_thread_handle();
    thread->time.signal = -1;
    nxt_thread_time_update(thread);

    nxt_main_task.thread = thread;
    nxt_main_task.log = thread->log;
    nxt_main_task.ident = nxt_task_next_ident();

    if (nxt_strerror_start() != NXT_OK) {
        return NXT_ERROR;
    }

    if (flags != -1) {
        nxt_debug(&nxt_main_task, "stderr flags: 0x%04Xd", flags);
    }

#ifdef _SC_NPROCESSORS_ONLN

    n = sysconf(_SC_NPROCESSORS_ONLN);

#elif (NXT_HPUX)
    n = mpctl(MPC_GETNUMSPUS, NULL, NULL);

#else
    n = 0;

#endif

    nxt_debug(&nxt_main_task, "ncpu: %d", n);

    if (n > 1) {
        nxt_ncpu = n;
    }

    nxt_thread_spin_init(nxt_ncpu, 0);

    nxt_random_init(&thread->random);

    nxt_pagesize = getpagesize();

    nxt_debug(&nxt_main_task, "pagesize: %ui", nxt_pagesize);

    if (argv != NULL) {
        update = (argv[0] == app);

        nxt_process_arguments(&nxt_main_task, argv, envp);

        if (update) {
            nxt_log_start(nxt_process_argv[0]);
        }
    }

    return NXT_OK;
}

0x622e00 <vtable for std::__Fuzzer::ios_base::failure+8> "\260.b"


nxt_int_t
nxt_strerror_start(void)
{
    char        *msg;
    u_char      *p;
    size_t      size, length, n;
    nxt_uint_t  err, invalid;

    size = nxt_length("Unknown error");

    for (invalid = 0; invalid < 100 && nxt_sys_nerr < 65536; nxt_sys_nerr++) {

        nxt_set_errno(0);
        msg = strerror((int) nxt_sys_nerr);

        if (msg == NULL) {
            invalid++;
            continue;
        }

        length = nxt_strlen(msg);
        size += length;

        if (length == 0
            || nxt_errno == NXT_EINVAL
            || memcmp(msg, "Unknown error", 13) == 0)
        {
            invalid++;
            continue;
        }

#if (NXT_AIX)

        if (memcmp(msg, "Error ", 6) == 0
            && memcmp(msg + length - 10, " occurred.", 9) == 0)
        {
            invalid++;
            continue;
        }

#endif
    }

    nxt_sys_nerr -= invalid;

    nxt_main_log_debug("sys_nerr: %d", nxt_sys_nerr);

    n = (nxt_sys_nerr + 1) * sizeof(nxt_str_t);

    nxt_sys_errlist = nxt_malloc(n + size);
    if (nxt_sys_errlist == NULL) {
        return NXT_ERROR;
    }

    p = nxt_pointer_to(nxt_sys_errlist, n);

    for (err = 0; err < nxt_sys_nerr; err++) {
        msg = strerror((int) err);
        length = nxt_strlen(msg);

        nxt_sys_errlist[err].length = length;
        nxt_sys_errlist[err].start = p;

        p = nxt_cpymem(p, msg, length);
    }

    nxt_sys_errlist[err].length = 13;
    nxt_sys_errlist[err].start = p;
    nxt_memcpy(p, "Unknown error", 13);

    nxt_strerror = nxt_runtime_strerror;

    return NXT_OK;
}


void
colour_palette_init(struct colour_palette *p)
{
	p->fg = 8;
	p->bg = 8;
	p->palette = NULL;
	p->default_palette = NULL;
}


void
screen_init(struct screen *s, u_int sx, u_int sy, u_int hlimit)
{
	s->grid = grid_create(sx, sy, hlimit);
	s->saved_grid = NULL;

	s->title = xstrdup("");
	s->titles = NULL;
	s->path = NULL;

	s->cstyle = SCREEN_CURSOR_DEFAULT;
	s->default_cstyle = SCREEN_CURSOR_DEFAULT;
	s->mode = MODE_CURSOR;
	s->default_mode = 0;
	s->ccolour = -1;
	s->default_ccolour = -1;
	s->tabs = NULL;
	s->sel = NULL;

#ifdef ENABLE_SIXEL
	TAILQ_INIT(&s->images);
#endif

	s->write_list = NULL;
	s->hyperlinks = NULL;

	screen_reinit(s);
}

0x800000008 <error: Cannot access memory at address 0x800000008>

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0xffffffff


extern int
onig_detect_can_be_slow_pattern(const UChar* pattern,
  const UChar* pattern_end, OnigOptionType option, OnigEncoding enc,
  OnigSyntaxType* syntax)
{
  int r;
  regex_t* reg;
  Node* root;
  ParseEnv scan_env;
  SlowElementCount count;
  int calls[MAX_CALLS_IN_DETECT];
#ifdef USE_CALL
  UnsetAddrList  uslist = {0};
#endif

  reg = (regex_t* )xmalloc(sizeof(regex_t));
  if (IS_NULL(reg)) return ONIGERR_MEMORY;

  r = onig_reg_init(reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
  if (r != 0) {
    xfree(reg);
    return r;
  }

  r = parse_and_tune(reg, pattern, pattern_end, &scan_env, &root, NULL
#ifdef USE_CALL
                     , &uslist
#endif
                    );
  if (r != 0) goto err;

#ifdef USE_CALL
  if (scan_env.num_call > 0) {
    unset_addr_list_end(&uslist);
  }
#endif

  count.prec_read          = 0;
  count.look_behind        = 0;
  count.backref            = 0;
  count.backref_with_level = 0;
  count.call               = 0;
  count.is_keep            = FALSE;
  count.anychar_reluctant_many     = 0;
  count.empty_check_nest_level     = 0;
  count.max_empty_check_nest_level = 0;
  count.heavy_element = 0;

  r = detect_can_be_slow(root, &count, 0, calls);
  if (r == 0) {
    int n;

    n = count.prec_read + count.look_behind
      + count.backref + count.backref_with_level + count.call
      + count.anychar_reluctant_many;

    if (count.is_keep) count.max_empty_check_nest_level++;

    if (count.max_empty_check_nest_level > 2)
      n += count.max_empty_check_nest_level - 2;
    if (count.heavy_element != 0) {
      if (count.heavy_element < 0x10000)
        n += count.heavy_element << 8;
      else
        n += count.heavy_element;
    }

    r = n;

#ifdef ONIG_DEBUG_PARSE
    fprintf(DBGFP, "-- detect can be slow --\n");
    fprintf(DBGFP, "  prec_read:          %d\n", count.prec_read);
    fprintf(DBGFP, "  look_behind:        %d\n", count.look_behind);
    fprintf(DBGFP, "  backref:            %d\n", count.backref);
    fprintf(DBGFP, "  backref_with_level: %d\n", count.backref_with_level);
    fprintf(DBGFP, "  call:               %d\n", count.call);
    fprintf(DBGFP, "  is_keep:            %d\n", count.is_keep);
    fprintf(DBGFP, "  any_reluctant_many: %d\n", count.anychar_reluctant_many);
    fprintf(DBGFP, "  max_empty_check_nest_level: %d\n", count.max_empty_check_nest_level);
    fprintf(DBGFP, "  heavy_element:      %d\n", count.heavy_element);
    fprintf(DBGFP, "  r:                  %d\n", r);
    fprintf(DBGFP, "\n");
#endif
  }

  if (IS_NOT_NULL(scan_env.mem_env_dynamic))
    xfree(scan_env.mem_env_dynamic);

 err:
  onig_node_free(root);
  onig_free(reg);
  return r;
}


extern int
onigenc_init(void)
{
  if (OnigEncInited != 0) return 0;

  OnigEncInited = 1;
  return 0;
}


static int
init(void)
{
#ifdef USE_CALLOUT

    int id;
    OnigEncoding enc;
    char* name;
    unsigned int args[4];
    OnigValue    opts[4];

    enc = ONIG_ENCODING_ASCII;

    name = "FAIL";        BC0_P(name, fail);
    name = "MISMATCH";    BC0_P(name, mismatch);

    name = "MAX";
    args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
    args[1] = ONIG_TYPE_CHAR;
    opts[0].c = 'X';
    BC_B_O(name, max, 2, args, 1, opts);

    name = "ERROR";
    args[0] = ONIG_TYPE_LONG; opts[0].l = ONIG_ABORT;
    BC_P_O(name, error, 1, args, 1, opts);

    name = "COUNT";
    args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
    BC_B_O(name, count, 1, args, 1, opts);

    name = "TOTAL_COUNT";
    args[0] = ONIG_TYPE_CHAR; opts[0].c = '>';
    BC_B_O(name, total_count, 1, args, 1, opts);

    name = "CMP";
    args[0] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
    args[1] = ONIG_TYPE_STRING;
    args[2] = ONIG_TYPE_TAG | ONIG_TYPE_LONG;
    BC_P(name, cmp, 3, args);

#endif

  return ONIG_NORMAL;
}


void ddsi_iid_init (void)
{
  union { uint64_t u64; uint32_t u32[2]; } tmp;
  ddsrt_prng_seed_t seed;
  DDSRT_STATIC_ASSERT (sizeof (seed.key) >= sizeof (ddsi_iid.key));

  if (ddsrt_prng_makeseed (&seed))
    memcpy (ddsi_iid.key, seed.key, sizeof (ddsi_iid.key));
  else
  {
    for (size_t i = 0; i < sizeof (ddsi_iid.key) / sizeof (ddsi_iid.key[0]); i++)
      ddsi_iid.key[i] = ddsrt_random ();
  }
  tmp.u64 = 0;
  dds_tea_decrypt (tmp.u32, ddsi_iid.key);
  ddsrt_atomic_st64 (&ddsi_iid.counter, tmp.u64);
}


void
CxPlatSystemLoad(
    void
    )
{
#if defined(CX_PLATFORM_DARWIN)

    CxPlatProcessorCount = 1;
#else
    CxPlatProcessorCount = (uint32_t)sysconf(_SC_NPROCESSORS_ONLN);
#endif

#ifdef CXPLAT_NUMA_AWARE
    if (numa_available() >= 0) {
        CxPlatNumaNodeCount = (uint32_t)numa_num_configured_nodes();
        CxPlatNumaNodeMasks =
            CXPLAT_ALLOC_NONPAGED(sizeof(cpu_set_t) * CxPlatNumaNodeCount, QUIC_POOL_PLATFORM_PROC);
        CXPLAT_FRE_ASSERT(CxPlatNumaNodeMasks);
        for (uint32_t n = 0; n < CxPlatNumaNodeCount; ++n) {
            CPU_ZERO(&CxPlatNumaNodeMasks[n]);
            CXPLAT_FRE_ASSERT(numa_node_to_cpus_compat((int)n, CxPlatNumaNodeMasks[n].__bits, sizeof(cpu_set_t)) >= 0);
        }
    } else {
        CxPlatNumaNodeCount = 0;
    }
#endif

#ifdef DEBUG
    CxPlatform.AllocFailDenominator = 0;
    CxPlatform.AllocCounter = 0;
#endif

    long ShouldLoad = 1;

    char *DisableValue = getenv("QUIC_LTTng");
    if (DisableValue != NULL) {
        ShouldLoad = strtol(DisableValue, NULL, 10);
    }

    if (!ShouldLoad) {
        goto Exit;
    }

    Dl_info Info;
    int Succeeded = dladdr((void *)CxPlatSystemLoad, &Info);
    if (!Succeeded) {
        goto Exit;
    }

    size_t PathLen = strlen(Info.dli_fname);

    int LastTrailingSlashLen = -1;
    for (int i = PathLen; i >= 0; i--) {
        if (Info.dli_fname[i] == '/') {
            LastTrailingSlashLen = i + 1;
            break;
        }
    }

    if (LastTrailingSlashLen == -1) {
        goto Exit;
    }

    size_t TpLibNameLen = strlen(TpLibName);
    size_t ProviderFullPathLength = TpLibNameLen + LastTrailingSlashLen + 1;

    char* ProviderFullPath = CXPLAT_ALLOC_PAGED(ProviderFullPathLength, QUIC_POOL_PLATFORM_TMP_ALLOC);
    if (ProviderFullPath == NULL) {
        goto Exit;
    }

    CxPlatCopyMemory(ProviderFullPath, Info.dli_fname, LastTrailingSlashLen);
    CxPlatCopyMemory(ProviderFullPath + LastTrailingSlashLen, TpLibName, TpLibNameLen);
    ProviderFullPath[LastTrailingSlashLen + TpLibNameLen] = '\0';

    dlopen(ProviderFullPath, RTLD_NOW | RTLD_GLOBAL);

    CXPLAT_FREE(ProviderFullPath, QUIC_POOL_PLATFORM_TMP_ALLOC);

Exit:

    QuicTraceLogInfo(
        PosixLoaded,
        "[ dso] Loaded");
}


uint64_t
CGroupGetMemoryLimit()
{
    uint64_t PhysicalMemoryLimit = 0;
    uint64_t RestrictedMemoryLimit = 0;

    CGroupInitialize();

    PhysicalMemoryLimit = GetPhysicalMemoryLimit();

    if (!GetCGroupRestrictedMemoryLimit(&RestrictedMemoryLimit)) {
        goto Done;
    }

    if (RestrictedMemoryLimit > 0x7FFFFFFF00000000) {
        goto Done;
    }

    struct rlimit CurrRlimit;
    size_t RlimitSoftLimit = (size_t)RLIM_INFINITY;
    if (getrlimit(RLIMIT_AS, &CurrRlimit) == 0) {
        RlimitSoftLimit = CurrRlimit.rlim_cur;
    }
    RestrictedMemoryLimit = (RestrictedMemoryLimit < RlimitSoftLimit) ?
                             RestrictedMemoryLimit : RlimitSoftLimit;

    PhysicalMemoryLimit = (RestrictedMemoryLimit < PhysicalMemoryLimit) ?
                             RestrictedMemoryLimit : PhysicalMemoryLimit;

    if (PhysicalMemoryLimit > SIZE_T_MAX)
    {

        PhysicalMemoryLimit = SIZE_T_MAX;
    }

Done:

    CGroupCleanup();

    if (PhysicalMemoryLimit == 0) {
        PhysicalMemoryLimit = 0x40000000;
    }

    return PhysicalMemoryLimit;
}


int
sonmp_decode(struct lldpd *cfg, char *frame, int s, struct lldpd_hardware *hardware,
    struct lldpd_chassis **newchassis, struct lldpd_port **newport)
{
	const u_int8_t mcastaddr[] = SONMP_MULTICAST_ADDR;
	struct lldpd_chassis *chassis;
	struct lldpd_port *port;
	struct lldpd_mgmt *mgmt;
	int length, i;
	u_int8_t *pos;
	u_int8_t seg[3], rchassis;
	struct in_addr address;

	log_debug("sonmp", "decode SONMP PDU from %s", hardware->h_ifname);

	if ((chassis = calloc(1, sizeof(struct lldpd_chassis))) == NULL) {
		log_warn("sonmp", "failed to allocate remote chassis");
		return -1;
	}
	TAILQ_INIT(&chassis->c_mgmt);
	if ((port = calloc(1, sizeof(struct lldpd_port))) == NULL) {
		log_warn("sonmp", "failed to allocate remote port");
		free(chassis);
		return -1;
	}
#  ifdef ENABLE_DOT1
	TAILQ_INIT(&port->p_vlans);
#  endif

	length = s;
	pos = (u_int8_t *)frame;
	if (length < SONMP_SIZE + 2 * ETHER_ADDR_LEN + sizeof(u_int16_t)) {
		log_warnx("sonmp", "too short SONMP frame received on %s",
		    hardware->h_ifname);
		goto malformed;
	}
	if (PEEK_CMP(mcastaddr, sizeof(mcastaddr)) != 0)

		goto malformed;

	PEEK_DISCARD(ETHER_ADDR_LEN);
	PEEK_DISCARD_UINT16;
	PEEK_DISCARD(6);
	if (PEEK_UINT16 != LLC_PID_SONMP_HELLO) {
		log_debug("sonmp", "incorrect LLC protocol ID received for SONMP on %s",
		    hardware->h_ifname);
		goto malformed;
	}

	chassis->c_id_subtype = LLDP_CHASSISID_SUBTYPE_ADDR;
	if ((chassis->c_id = calloc(1, sizeof(struct in_addr) + 1)) == NULL) {
		log_warn("sonmp", "unable to allocate memory for chassis id on %s",
		    hardware->h_ifname);
		goto malformed;
	}
	chassis->c_id_len = sizeof(struct in_addr) + 1;
	chassis->c_id[0] = 1;
	PEEK_BYTES(&address, sizeof(struct in_addr));
	memcpy(chassis->c_id + 1, &address, sizeof(struct in_addr));
	if (asprintf(&chassis->c_name, "%s", inet_ntoa(address)) == -1) {
		log_warnx("sonmp", "unable to write chassis name for %s",
		    hardware->h_ifname);
		goto malformed;
	}
	PEEK_BYTES(seg, sizeof(seg));
	rchassis = PEEK_UINT8;
	for (i = 0; sonmp_chassis_types[i].type != 0; i++) {
		if (sonmp_chassis_types[i].type == rchassis) break;
	}
	if (asprintf(&chassis->c_descr, "%s", sonmp_chassis_types[i].description) ==
	    -1) {
		log_warnx("sonmp", "unable to write chassis description for %s",
		    hardware->h_ifname);
		goto malformed;
	}
	mgmt = lldpd_alloc_mgmt(LLDPD_AF_IPV4, &address, sizeof(struct in_addr), 0);
	if (mgmt == NULL) {
		if (errno == ENOMEM)
			log_warn("sonmp",
			    "unable to allocate memory for management address");
		else
			log_warn("sonmp", "too large management address received on %s",
			    hardware->h_ifname);
		goto malformed;
	}
	TAILQ_INSERT_TAIL(&chassis->c_mgmt, mgmt, m_entries);
	port->p_ttl =
	    cfg ? (cfg->g_config.c_tx_interval * cfg->g_config.c_tx_hold) : LLDPD_TTL;
	port->p_ttl = (port->p_ttl + 999) / 1000;

	port->p_id_subtype = LLDP_PORTID_SUBTYPE_LOCAL;

	port->p_id_len =
	    asprintf(&port->p_id, "%02x-%02x-%02x", seg[0], seg[1], seg[2]);
	if (port->p_id_len == -1) {
		log_warn("sonmp", "unable to allocate memory for port id on %s",
		    hardware->h_ifname);
		goto malformed;
	}

	if ((seg[0] == 0) && (seg[1] == 0)) {
		if (asprintf(&port->p_descr, "port %d", seg[2]) == -1) {
			log_warnx("sonmp", "unable to write port description for %s",
			    hardware->h_ifname);
			goto malformed;
		}
	} else if (seg[0] == 0) {
		if (asprintf(&port->p_descr, "port %d/%d", seg[1], seg[2]) == -1) {
			log_warnx("sonmp", "unable to write port description for %s",
			    hardware->h_ifname);
			goto malformed;
		}
	} else {
		if (asprintf(&port->p_descr, "port %x:%x:%x", seg[0], seg[1], seg[2]) ==
		    -1) {
			log_warnx("sonmp", "unable to write port description for %s",
			    hardware->h_ifname);
			goto malformed;
		}
	}
	*newchassis = chassis;
	*newport = port;
	return 1;

malformed:
	lldpd_chassis_cleanup(chassis, 1);
	lldpd_port_cleanup(port, 1);
	free(port);
	return -1;
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x18

Cannot access memory at address 0x18


void
lldpd_port_cleanup(struct lldpd_port *port, int all)
{
#ifdef ENABLE_LLDPMED
	int i;
	if (all)
		for (i = 0; i < LLDP_MED_LOCFORMAT_LAST; i++)
			free(port->p_med_location[i].data);
#endif
#ifdef ENABLE_DOT1
	lldpd_vlan_cleanup(port);
	lldpd_ppvid_cleanup(port);
	lldpd_pi_cleanup(port);
#endif

	if (all) {
		free(port->p_id);
		port->p_id = NULL;
		free(port->p_descr);
		port->p_descr = NULL;
		free(port->p_lastframe);
		if (port->p_chassis) {
			port->p_chassis->c_refcount--;
			port->p_chassis = NULL;
		}
#ifdef ENABLE_CUSTOM
		lldpd_custom_list_cleanup(port);
#endif
	}
}


hashtab_t hashtab_create(unsigned int (*hash_value) (hashtab_t h,
						     const_hashtab_key_t key),
			 int (*keycmp) (hashtab_t h,
					const_hashtab_key_t key1,
					const_hashtab_key_t key2),
			 unsigned int size)
{

	hashtab_t p;

	p = (hashtab_t) malloc(sizeof(hashtab_val_t));
	if (p == NULL)
		return p;

	memset(p, 0, sizeof(hashtab_val_t));
	p->size = size;
	p->nel = 0;
	p->hash_value = hash_value;
	p->keycmp = keycmp;
	p->htable = (hashtab_ptr_t *) calloc(size, sizeof(hashtab_ptr_t));
	if (p->htable == NULL) {
		free(p);
		return NULL;
	}

	return p;
}


int symtab_init(symtab_t * s, unsigned int size)
{
	s->table = hashtab_create(symhash, symcmp, size);
	if (!s->table)
		return -1;
	s->nprim = 0;
	return 0;
}


int policydb_init(policydb_t * p)
{
	int i, rc;

	memset(p, 0, sizeof(policydb_t));

	for (i = 0; i < SYM_NUM; i++) {
		p->sym_val_to_name[i] = NULL;
		rc = symtab_init(&p->symtab[i], symtab_sizes[i]);
		if (rc)
			goto err;
	}

	for (i = 0; i < SYM_NUM; i++) {
		if (symtab_init(&p->scope[i], symtab_sizes[i])) {
			goto err;
		}
	}
	if ((p->global = avrule_block_create()) == NULL ||
	    (p->global->branch_list = avrule_decl_create(1)) == NULL) {
		goto err;
	}
	p->decl_val_to_struct = NULL;

	rc = avtab_init(&p->te_avtab);
	if (rc)
		goto err;

	rc = roles_init(p);
	if (rc)
		goto err;

	rc = cond_policydb_init(p);
	if (rc)
		goto err;

	p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp, (1 << 10));
	if (!p->filename_trans) {
		rc = -ENOMEM;
		goto err;
	}

	p->range_tr = hashtab_create(rangetr_hash, rangetr_cmp, 256);
	if (!p->range_tr) {
		rc = -ENOMEM;
		goto err;
	}

	ebitmap_init(&p->policycaps);
	ebitmap_init(&p->permissive_map);

	return 0;
err:
	hashtab_destroy(p->filename_trans);
	hashtab_destroy(p->range_tr);
	for (i = 0; i < SYM_NUM; i++) {
		hashtab_destroy(p->symtab[i].table);
		hashtab_destroy(p->scope[i].table);
	}
	avrule_block_list_destroy(p->global);
	return rc;
}


int avtab_init(avtab_t * h)
{
	h->htable = NULL;
	h->nel = 0;
	return 0;
}


int add_i_to_a(uint32_t i, uint32_t * cnt, uint32_t ** a)
{
	uint32_t *new;

	if (cnt == NULL || *cnt == UINT32_MAX || a == NULL)
		return -1;

	if (*a != NULL)
		new = (uint32_t *) reallocarray(*a, *cnt + 1, sizeof(uint32_t));
	else {

		*cnt = 0;
		new = (uint32_t *) malloc(sizeof(uint32_t));
	}
	if (new == NULL) {
		return -1;
	}
	new[*cnt] = i;
	(*cnt)++;
	*a = new;
	return 0;
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x725f7463656a626f


void set_source_file(const char *name)
{
	source_lineno = 1;
	strncpy(source_file, name, sizeof(source_file)-1);
	source_file[sizeof(source_file)-1] = '\0';
	if (strlen(source_file) && source_file[strlen(source_file)-1] == '"')
		source_file[strlen(source_file)-1] = '\0';
}


void init_parser(int pass_number)
{
	policydb_lineno = 1;
	source_lineno = 1;
	policydb_errors = 0;
	pass = pass_number;
}


void sepol_sidtab_destroy(sidtab_t * s)
{
	int i;
	sidtab_ptr_t cur, temp;

	if (!s || !s->htable)
		return;

	for (i = 0; i < SIDTAB_SIZE; i++) {
		cur = s->htable[i];
		while (cur != NULL) {
			temp = cur;
			cur = cur->next;
			context_destroy(&temp->context);
			free(temp);
		}
		s->htable[i] = NULL;
	}
	free(s->htable);
	s->htable = NULL;
	s->nel = 0;
	s->next_sid = 1;
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0xffffffff00000000


void ebitmap_destroy(ebitmap_t * e)
{
	ebitmap_node_t *n, *temp;

	if (!e)
		return;

	n = e->node;
	while (n) {
		temp = n;
		n = n->next;
		free(temp);
	}

	e->highbit = 0;
	e->node = 0;
	return;
}


void module_compiler_reset(void)
{
	while (stack_top)
		pop_stack();

	last_block = NULL;
	next_decl_id = 1;
}


int shm_address_in(void *p)
{
	int i;

	for(i = 0; i < _shm_core_pools_num; i++) {
		if(_shm_core_pools_mem[i] == (void *)-1) {
			continue;
		}
		if(((char *)p >= (char *)_shm_core_pools_mem[i])
				&& ((char *)p
						< ((char *)_shm_core_pools_mem[i]) + shm_mem_size)) {

			return 1;
		}
	}

	return 0;
}


int libfsapfs_io_handle_initialize(
     libfsapfs_io_handle_t **io_handle,
     libcerror_error_t **error )
{
	static char *function = "libfsapfs_io_handle_initialize";

	if( io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid IO handle.",
		 function );

		return( -1 );
	}
	if( *io_handle != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid IO handle value already set.",
		 function );

		return( -1 );
	}
	*io_handle = memory_allocate_structure(
	              libfsapfs_io_handle_t );

	if( *io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create IO handle.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *io_handle,
	     0,
	     sizeof( libfsapfs_io_handle_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear IO handle.",
		 function );

		memory_free(
		 *io_handle );

		*io_handle = NULL;

		return( -1 );
	}
#if defined( HAVE_PROFILER )
	if( libfsapfs_profiler_initialize(
	     &( ( *io_handle )->profiler ),
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to initialize profiler.",
		 function );

		goto on_error;
	}
	if( libfsapfs_profiler_open(
	     ( *io_handle )->profiler,
	     "profiler.csv",
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_IO,
		 LIBCERROR_IO_ERROR_OPEN_FAILED,
		 "%s: unable to open profiler.",
		 function );

		goto on_error;
	}
#endif

	( *io_handle )->bytes_per_sector = 512;
	( *io_handle )->block_size       = 4096;

	return( 1 );

on_error:
	if( *io_handle != NULL )
	{
#if defined( HAVE_PROFILER )
		if( ( *io_handle )->profiler != NULL )
		{
			libfsapfs_profiler_free(
			 &( ( *io_handle )->profiler ),
			 NULL );
		}
#endif
		memory_free(
		 *io_handle );

		*io_handle = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x1004c73e0

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x11

Cannot access memory at address 0x11


int libfshfs_extents_record_read_data(
     libfshfs_fork_descriptor_t *fork_descriptor,
     uint16_t extents_start_block_number,
     const uint8_t *data,
     size_t data_size,
     libcerror_error_t **error )
{
	static char *function                 = "libfshfs_extents_record_read_data";
	size_t data_offset                    = 0;
	uint32_t physical_extent_block_number = 0;
	uint16_t extent_block_number          = 0;
	uint16_t extent_number_of_blocks      = 0;
	int extent_index                      = 0;

	if( fork_descriptor == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid fork descriptor.",
		 function );

		return( -1 );
	}
	if( data == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
		 "%s: invalid data.",
		 function );

		return( -1 );
	}
	if( data_size > (size_t) SSIZE_MAX )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid data size value out of bounds.",
		 function );

		return( -1 );
	}
#if defined( HAVE_DEBUG_OUTPUT )
	if( libcnotify_verbose != 0 )
	{
		libcnotify_printf(
		 "%s: extents records data:\n",
		 function );
		libcnotify_print_data(
		 data,
		 data_size,
		 LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA );
	}
#endif
	if( data_size != 12 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
		 "%s: unsupported extents record data size: %" PRIzd "\n",
		 function,
		 data_size );

		return( -1 );
	}
	while( data_offset < 12 )
	{
		byte_stream_copy_to_uint16_big_endian(
		 &( data[ data_offset ] ),
		 extent_block_number );

		data_offset += 2;

		byte_stream_copy_to_uint16_big_endian(
		 &( data[ data_offset ] ),
		 extent_number_of_blocks );

		data_offset += 2;

		physical_extent_block_number = extent_block_number;

		if( extent_number_of_blocks > 0 )
		{
			physical_extent_block_number += extents_start_block_number;
		}
#if defined( HAVE_DEBUG_OUTPUT )
		if( libcnotify_verbose != 0 )
		{
			libcnotify_printf(
			 "%s: extent: %d block number\t\t: %" PRIu32 " (%" PRIu16 ")\n",
			 function,
			 extent_index,
			 physical_extent_block_number,
			 extent_block_number );

			libcnotify_printf(
			 "%s: extent: %d number of blocks\t\t: %" PRIu16 "\n",
			 function,
			 extent_index,
			 extent_number_of_blocks );
		}
#endif

		fork_descriptor->extents[ extent_index ][ 0 ] = physical_extent_block_number;
		fork_descriptor->extents[ extent_index ][ 1 ] = extent_number_of_blocks;

		fork_descriptor->number_of_blocks_in_extents += extent_number_of_blocks;

		extent_index++;
	}
#if defined( HAVE_DEBUG_OUTPUT )
	if( libcnotify_verbose != 0 )
	{
		libcnotify_printf(
		 "\n" );
	}
#endif
	return( 1 );
}

size_t data_offset                    = 0;

0x600 <error: Cannot access memory at address 0x600>


int libcdata_array_initialize(
     libcdata_array_t **array,
     int number_of_entries,
     libcerror_error_t **error )
{
	libcdata_internal_array_t *internal_array = NULL;
	static char *function                     = "libcdata_array_initialize";
	size_t entries_size                       = 0;
	int number_of_allocated_entries           = 0;

	if( array == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid array.",
		 function );

		return( -1 );
	}
	if( *array != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid array value already set.",
		 function );

		return( -1 );
	}
	if( number_of_entries < 0 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_LESS_THAN_ZERO,
		 "%s: invalid number of entries value less than zero.",
		 function );

		return( -1 );
	}
	internal_array = memory_allocate_structure(
	                  libcdata_internal_array_t );

	if( internal_array == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create array.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     internal_array,
	     0,
	     sizeof( libcdata_internal_array_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear array.",
		 function );

		memory_free(
		 internal_array );

		return( -1 );
	}

	if( number_of_entries >= (int) ( INT_MAX - 16 ) )
	{
		number_of_allocated_entries = INT_MAX;
	}
	else
	{
		number_of_allocated_entries = ( number_of_entries & ~( 15 ) ) + 16;
	}
#if SIZEOF_INT <= SIZEOF_SIZE_T
	if( (size_t) number_of_allocated_entries > (size_t) ( SSIZE_MAX / sizeof( intptr_t * ) ) )
#else
	if( number_of_allocated_entries > (int) ( SSIZE_MAX / sizeof( intptr_t * ) ) )
#endif
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid number of allocated entries value exceeds maximum.",
		 function );

		goto on_error;
	}
	entries_size = sizeof( intptr_t * ) * number_of_allocated_entries;

	if( entries_size > (size_t) LIBCDATA_ARRAY_ENTRIES_MEMORY_LIMIT )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid entries size value exceeds maximum.",
		 function );

		goto on_error;
	}
	internal_array->entries = (intptr_t **) memory_allocate(
	                                         entries_size );

	if( internal_array->entries == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create array entries.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     internal_array->entries,
	     0,
	     entries_size ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear array entries.",
		 function );

		goto on_error;
	}
	internal_array->number_of_allocated_entries = number_of_allocated_entries;
	internal_array->number_of_entries           = number_of_entries;

#if defined( HAVE_MULTI_THREAD_SUPPORT ) && !defined( HAVE_LOCAL_LIBCDATA )
	if( libcthreads_read_write_lock_initialize(
	     &( internal_array->read_write_lock ),
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to initialize read/write lock.",
		 function );

		goto on_error;
	}
#endif
	*array = (libcdata_array_t *) internal_array;

	return( 1 );

on_error:
	if( internal_array != NULL )
	{
		if( internal_array->entries != NULL )
		{
			memory_free(
			 internal_array->entries );
		}
		memory_free(
		 internal_array );
	}
	return( -1 );
}

size_t entries_size                       = 0;

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x200

Cannot access memory at address 0x200

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x7366780800000200


int libfwnt_huffman_tree_initialize(
     libfwnt_huffman_tree_t **huffman_tree,
     int number_of_symbols,
     uint8_t maximum_code_size,
     libcerror_error_t **error )
{
	static char *function = "libfwnt_huffman_tree_initialize";
	size_t array_size     = 0;

	if( huffman_tree == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid Huffman tree.",
		 function );

		return( -1 );
	}
	if( *huffman_tree != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid Huffman tree value already set.",
		 function );

		return( -1 );
	}
	if( ( number_of_symbols < 0 )
	 || ( number_of_symbols > 1024 ) )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid number of symbols value out of bounds.",
		 function );

		return( -1 );
	}
	if( maximum_code_size > 32 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid maximum code size value out of bounds.",
		 function );

		return( -1 );
	}
	*huffman_tree = memory_allocate_structure(
	                 libfwnt_huffman_tree_t );

	if( *huffman_tree == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create Huffman tree.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *huffman_tree,
	     0,
	     sizeof( libfwnt_huffman_tree_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear Huffman tree.",
		 function );

		memory_free(
		 *huffman_tree );

		*huffman_tree = NULL;

		return( -1 );
	}
	array_size = sizeof( int ) * number_of_symbols;

	( *huffman_tree )->symbols = (int *) memory_allocate(
	                                      array_size );

	if( ( *huffman_tree )->symbols == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create symbols.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     ( *huffman_tree )->symbols,
	     0,
	     array_size ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear symbols.",
		 function );

		goto on_error;
	}
	array_size = sizeof( int ) * ( maximum_code_size + 1 );

	( *huffman_tree )->code_size_counts = (int *) memory_allocate(
	                                               array_size );

	if( ( *huffman_tree )->code_size_counts == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create code size counts.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     ( *huffman_tree )->code_size_counts,
	     0,
	     array_size ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear code size counts.",
		 function );

		goto on_error;
	}
	( *huffman_tree )->maximum_code_size = maximum_code_size;

	return( 1 );

on_error:
	if( *huffman_tree != NULL )
	{
		if( ( *huffman_tree )->code_size_counts != NULL )
		{
			memory_free(
			 ( *huffman_tree )->code_size_counts );
		}
		if( ( *huffman_tree )->symbols != NULL )
		{
			memory_free(
			 ( *huffman_tree )->symbols );
		}
		memory_free(
		 *huffman_tree );

		*huffman_tree = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x8000

Cannot access memory at address 0x8000

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x20

Cannot access memory at address 0x20


int libesedb_checksum_calculate_little_endian_xor32(
     uint32_t *checksum_value,
     const uint8_t *buffer,
     size_t size,
     uint32_t initial_value,
     libcerror_error_t **error )
{
	libesedb_aligned_t *aligned_buffer_iterator = NULL;
	uint8_t *buffer_iterator                    = NULL;
	static char *function                       = "libesedb_checksum_calculate_little_endian_xor32";
	libesedb_aligned_t value_aligned            = 0;
	uint32_t big_endian_value_32bit             = 0;
	uint32_t safe_checksum_value                = 0;
	uint32_t value_32bit                        = 0;
	uint8_t alignment_count                     = 0;
	uint8_t alignment_size                      = 0;
	uint8_t byte_count                          = 0;
	uint8_t byte_order                          = 0;
	uint8_t byte_size                           = 0;

	if( checksum_value == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid checksum value.",
		 function );

		return( -1 );
	}
	if( buffer == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid buffer.",
		 function );

		return( -1 );
	}
	if( size > (size_t) SSIZE_MAX )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid size value exceeds maximum.",
		 function );

		return( -1 );
	}
	safe_checksum_value = initial_value;

	buffer_iterator = (uint8_t *) buffer;

	if( ( ( sizeof( libesedb_aligned_t ) % 4 ) == 0 )
	 && ( size > ( 2 * sizeof( libesedb_aligned_t ) ) ) )
	{

		alignment_size = (uint8_t) ( (intptr_t) buffer_iterator % sizeof( libesedb_aligned_t ) );

		if( alignment_size > 0 )
		{
			byte_size = sizeof( libesedb_aligned_t ) - alignment_size;

			while( byte_size != 0 )
			{
				value_32bit = 0;
				byte_count  = 1;

				if( byte_size >= 4 )
				{
					value_32bit |= buffer_iterator[ 3 ];
					value_32bit <<= 8;

					byte_count++;
				}
				if( byte_size >= 3 )
				{
					value_32bit |= buffer_iterator[ 2 ];
					value_32bit <<= 8;

					byte_count++;
				}
				if( byte_size >= 2 )
				{
					value_32bit |= buffer_iterator[ 1 ];
					value_32bit <<= 8;

					byte_count++;
				}
				value_32bit |= buffer_iterator[ 0 ];

				buffer_iterator += byte_count;
				byte_size       -= byte_count;

				safe_checksum_value ^= value_32bit;
			}
			size -= byte_count;
		}
		aligned_buffer_iterator = (libesedb_aligned_t *) buffer_iterator;

		if( *buffer_iterator != (uint8_t) ( *aligned_buffer_iterator & 0xff ) )
		{
			byte_order = _BYTE_STREAM_ENDIAN_BIG;
		}
		else
		{
			byte_order = _BYTE_STREAM_ENDIAN_LITTLE;
		}

		while( size > sizeof( libesedb_aligned_t ) )
		{
			value_aligned ^= *aligned_buffer_iterator;

			aligned_buffer_iterator++;

			size -= sizeof( libesedb_aligned_t );
		}

		if( alignment_size > 0 )
		{
			byte_count      = ( alignment_size % 4 ) * 8;
			alignment_count = ( sizeof( libesedb_aligned_t ) - alignment_size ) * 8;

			if( byte_order == _BYTE_STREAM_ENDIAN_BIG )
			{

				big_endian_value_32bit = (uint32_t) ( ( value_aligned >> alignment_count ) << byte_count );

				value_32bit = ( ( big_endian_value_32bit & 0x000000ffUL ) << 24 )
				            | ( ( big_endian_value_32bit & 0x0000ff00UL ) << 8 )
				            | ( ( big_endian_value_32bit >> 8 ) & 0x0000ff00UL )
				            | ( ( big_endian_value_32bit >> 24 ) & 0x000000ffUL );

				value_aligned <<= alignment_count;
			}
			else if( byte_order == _BYTE_STREAM_ENDIAN_LITTLE )
			{
				value_32bit = (uint32_t) ( value_aligned << byte_count );

				value_aligned >>= alignment_count;
			}
			safe_checksum_value ^= value_32bit;
		}

		byte_size = (uint8_t) sizeof( libesedb_aligned_t );

		while( byte_size != 0 )
		{
			byte_count = ( ( byte_size / 4 ) - 1 ) * 32;

			if( byte_order == _BYTE_STREAM_ENDIAN_BIG )
			{
				big_endian_value_32bit = (uint32_t) ( ( value_aligned >> byte_count ) & 0xffffffffUL );

				value_32bit = ( ( big_endian_value_32bit & 0x000000ffUL ) << 24 )
				            | ( ( big_endian_value_32bit & 0x0000ff00UL ) << 8 )
				            | ( ( big_endian_value_32bit >> 8 ) & 0x0000ff00UL )
				            | ( ( big_endian_value_32bit >> 24 ) & 0x000000ffUL );
			}
			else if( byte_order == _BYTE_STREAM_ENDIAN_LITTLE )
			{
				value_32bit = (uint32_t) value_aligned;

				value_aligned >>= byte_count;
			}
			byte_size -= 4;

			safe_checksum_value ^= value_32bit;
		}

		buffer_iterator = (uint8_t *) aligned_buffer_iterator;

		byte_size = 4 - ( alignment_size % 4 );

		if( byte_size != 4 )
		{
			value_32bit   = buffer_iterator[ 0 ];
			value_32bit <<= 8;

			if( byte_size >= 2 )
			{
				value_32bit |= buffer_iterator[ 1 ];
			}
			value_32bit <<= 8;

			if( byte_size >= 3 )
			{
				value_32bit |= buffer_iterator[ 2 ];
			}
			value_32bit <<= 8;

			buffer_iterator += byte_size;
			size            -= byte_size;

			safe_checksum_value ^= value_32bit;
		}
	}
	while( size > 0 )
	{
		value_32bit = 0;
		byte_count  = 1;

		if( size >= 4 )
		{
			value_32bit |= buffer_iterator[ 3 ];
			value_32bit <<= 8;

			byte_count++;
		}
		if( size >= 3 )
		{
			value_32bit |= buffer_iterator[ 2 ];
			value_32bit <<= 8;

			byte_count++;
		}
		if( size >= 2 )
		{
			value_32bit |= buffer_iterator[ 1 ];
			value_32bit <<= 8;

			byte_count++;
		}
		value_32bit |= buffer_iterator[ 0 ];

		buffer_iterator += byte_count;
		size            -= byte_count;

		safe_checksum_value ^= value_32bit;
	}
	*checksum_value = safe_checksum_value;

	return( 1 );
}

uint32_t safe_checksum_value                = 0;

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x29c

Cannot access memory at address 0x29c


int libfvde_checksum_calculate_weak_crc32(
     uint32_t *checksum,
     const uint8_t *buffer,
     size_t size,
     uint32_t initial_value,
     libcerror_error_t **error )
{
	static char *function = "libfvde_checkcum_calculate_weak_crc32";
	size_t buffer_offset  = 0;
	uint32_t table_index  = 0;

	if( checksum == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid checksum.",
		 function );

		return( -1 );
	}
	if( buffer == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid buffer.",
		 function );

		return( -1 );
	}
	if( size > (size_t) SSIZE_MAX )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid size value exceeds maximum.",
		 function );

		return( -1 );
	}
        if( libfvde_checksum_crc32_table_computed == 0 )
	{
		libfvde_checksum_initialize_crc32_table(
		 0x82f63b78UL );
	}
	*checksum = initial_value;

        for( buffer_offset = 0;
	     buffer_offset < size;
	     buffer_offset++ )
	{
		table_index = ( *checksum ^ buffer[ buffer_offset ] ) & 0x000000ffUL;

		*checksum = libfvde_checksum_crc32_table[ table_index ] ^ ( *checksum >> 8 );
        }
	return( 1 );
}


int libfplist_xml_tag_free(
     libfplist_xml_tag_t **tag,
     libcerror_error_t **error )
{
	static char *function = "libfplist_xml_tag_free";
	int result            = 1;

	if( tag == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid XML plist tag.",
		 function );

		return( -1 );
	}
	if( *tag != NULL )
	{

		if( libcdata_array_free(
		     &( ( *tag )->elements_array ),
		     (int (*)(intptr_t **, libcerror_error_t **)) &libfplist_xml_tag_free,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
			 "%s: unable to free elements array.",
			 function );

			result = -1;
		}
		if( libcdata_array_free(
		     &( ( *tag )->attributes_array ),
		     (int (*)(intptr_t **, libcerror_error_t **)) &libfplist_xml_attribute_free,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
			 "%s: unable to free attributes array.",
			 function );

			result = -1;
		}
		if( ( *tag )->value != NULL )
		{
			memory_free(
			 ( *tag )->value );
		}
		if( ( *tag )->name != NULL )
		{
			memory_free(
			 ( *tag )->name );
		}
		memory_free(
		 *tag );

		*tag = NULL;
	}
	return( result );
}


int libfplist_xml_parser_parse_buffer(
     libfplist_property_list_t *property_list,
     uint8_t *buffer,
     size_t buffer_size,
     libcerror_error_t **error )
{
	libfplist_xml_parser_state_t parser_state;

	YY_BUFFER_STATE buffer_state = NULL;
	static char *function        = "libfplist_xml_parser_parse_buffer";
	int result                   = -1;

	if( buffer == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid buffer.",
		 function );

		return( -1 );
	}
	buffer_state = libfplist_xml_scanner__scan_buffer(
	                (char *) buffer,
	                buffer_size );

	libfplist_xml_scanner_buffer_offset = 0;

	if( buffer_state != NULL )
	{
		parser_state.property_list = property_list;
		parser_state.error         = error;
		parser_state.root_tag      = NULL;
		parser_state.current_tag   = NULL;
		parser_state.parent_tag    = NULL;

		if( libfplist_xml_scanner_parse(
		     &parser_state ) == 0 )
		{
			if( libfplist_property_list_set_root_tag(
			     property_list,
			     parser_state.root_tag,
			     error ) != 1 )
			{
				libcerror_error_set(
				 error,
				 LIBCERROR_ERROR_DOMAIN_RUNTIME,
				 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
				 "%s: unable to set root tag.",
				 function );

				result = -1;
			}
			else
			{
				parser_state.root_tag = NULL;

				result = 1;
			}
		}
		libfplist_xml_scanner__delete_buffer(
		 buffer_state );
	}
	libfplist_xml_scanner_lex_destroy();

	if( parser_state.root_tag != NULL )
	{
		libfplist_xml_tag_free(
		 &( parser_state.root_tag ),
		 NULL );
	}
	return( result );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x1000

Cannot access memory at address 0x1000

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x2

Cannot access memory at address 0x2


int libewf_io_handle_initialize(
     libewf_io_handle_t **io_handle,
     libcerror_error_t **error )
{
	static char *function = "libewf_io_handle_initialize";

	if( io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid IO handle.",
		 function );

		return( -1 );
	}
	if( *io_handle != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid IO handle value already set.",
		 function );

		return( -1 );
	}
	*io_handle = memory_allocate_structure(
	              libewf_io_handle_t );

	if( *io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create IO handle.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *io_handle,
	     0,
	     sizeof( libewf_io_handle_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear IO handle.",
		 function );

		goto on_error;
	}
	( *io_handle )->segment_file_type  = LIBEWF_SEGMENT_FILE_TYPE_UNDEFINED;
	( *io_handle )->format             = LIBEWF_FORMAT_ENCASE6;
	( *io_handle )->major_version      = 1;
	( *io_handle )->minor_version      = 0;
	( *io_handle )->compression_method = LIBEWF_COMPRESSION_METHOD_DEFLATE;
	( *io_handle )->compression_level  = LIBEWF_COMPRESSION_LEVEL_NONE;
	( *io_handle )->zero_on_error      = 1;
	( *io_handle )->header_codepage    = LIBEWF_CODEPAGE_ASCII;

	return( 1 );

on_error:
	if( *io_handle != NULL )
	{
		memory_free(
		 *io_handle );

		*io_handle = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x840fc08548c08949


int libewf_media_values_initialize(
     libewf_media_values_t **media_values,
     libcerror_error_t **error )
{
	static char *function = "libewf_media_values_initialize";

	if( media_values == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid media values.",
		 function );

		return( -1 );
	}
	if( *media_values != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid media values value already set.",
		 function );

		return( -1 );
	}
	*media_values = memory_allocate_structure(
	                 libewf_media_values_t );

	if( *media_values == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create media values.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *media_values,
	     0,
	     sizeof( libewf_media_values_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear media values.",
		 function );

		goto on_error;
	}
	( *media_values )->chunk_size        = LIBEWF_MINIMUM_CHUNK_SIZE;
	( *media_values )->sectors_per_chunk = 64;
	( *media_values )->bytes_per_sector  = 512;
	( *media_values )->media_flags       = 0x01;

	return( 1 );

on_error:
	if( *media_values != NULL )
	{
		memory_free(
		 *media_values );

		*media_values = NULL;
	}
	return( -1 );
}


int libewf_segment_file_initialize(
     libewf_segment_file_t **segment_file,
     libewf_io_handle_t *io_handle,
     libcerror_error_t **error )
{
	static char *function = "libewf_segment_file_initialize";

	if( segment_file == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid segment file.",
		 function );

		return( -1 );
	}
	if( *segment_file != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid segment file value already set.",
		 function );

		return( -1 );
	}
	if( io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid IO handle.",
		 function );

		return( -1 );
	}
	*segment_file = memory_allocate_structure(
	                 libewf_segment_file_t );

	if( *segment_file == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create segment file.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *segment_file,
	     0,
	     sizeof( libewf_segment_file_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear segment file.",
		 function );

		memory_free(
		 *segment_file );

		*segment_file = NULL;

		return( -1 );
	}
	if( libfdata_list_initialize(
	     &( ( *segment_file )->sections_list ),
	     (intptr_t *) *segment_file,
	     NULL,
	     NULL,
	     (int (*)(intptr_t *, intptr_t *, libfdata_list_element_t *, libfdata_cache_t *, int, off64_t, size64_t, uint32_t, uint8_t, libcerror_error_t **)) &libewf_segment_file_read_section_element_data,
	     NULL,
	     LIBFDATA_DATA_HANDLE_FLAG_NON_MANAGED,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create sections list.",
		 function );

		goto on_error;
	}
	if( libfdata_list_initialize(
	     &( ( *segment_file )->chunk_groups_list ),
	     (intptr_t *) *segment_file,
	     NULL,
	     NULL,
	     (int (*)(intptr_t *, intptr_t *, libfdata_list_element_t *, libfdata_cache_t *, int, off64_t, size64_t, uint32_t, uint8_t, libcerror_error_t **)) &libewf_segment_file_read_chunk_group_element_data,
	     NULL,
	     LIBFDATA_DATA_HANDLE_FLAG_NON_MANAGED,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create chunk groups list.",
		 function );

		goto on_error;
	}
	if( libfcache_cache_initialize(
	     &( ( *segment_file )->chunk_groups_cache ),
	     LIBEWF_MAXIMUM_CACHE_ENTRIES_CHUNK_GROUPS,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create chunk groups cache.",
		 function );

		goto on_error;
	}
	( *segment_file )->io_handle                        = io_handle;
	( *segment_file )->device_information_section_index = -1;
	( *segment_file )->previous_last_chunk_filled       = -1;
	( *segment_file )->last_chunk_filled                = -1;
	( *segment_file )->last_chunk_compared              = -1;

	return( 1 );

on_error:
	if( *segment_file != NULL )
	{
		if( ( *segment_file )->chunk_groups_list != NULL )
		{
			libfdata_list_free(
			 &( ( *segment_file )->chunk_groups_list ),
			 NULL );
		}
		if( ( *segment_file )->sections_list != NULL )
		{
			libfdata_list_free(
			 &( ( *segment_file )->sections_list ),
			 NULL );
		}
		memory_free(
		 *segment_file );

		*segment_file = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x1

Cannot access memory at address 0x1


int libfmapi_checksum_calculate_weak_crc32(
     uint32_t *checksum,
     const uint8_t *buffer,
     size_t size,
     uint32_t initial_value,
     libcerror_error_t **error )
{
	static char *function  = "libfmapi_checksum_calculate_weak_crc32";
	size_t buffer_offset   = 0;
	uint32_t safe_checksum = 0;
	uint32_t table_index   = 0;

	if( checksum == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid checksum.",
		 function );

		return( -1 );
	}
	if( buffer == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid buffer.",
		 function );

		return( -1 );
	}
	if( size > (size_t) SSIZE_MAX )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid size value exceeds maximum.",
		 function );

		return( -1 );
	}
        if( libfmapi_checksum_crc32_table_computed == 0 )
	{
		libfmapi_checksum_initialize_crc32_table(
		 0xedb88320UL );
	}
	safe_checksum = initial_value;

        for( buffer_offset = 0;
	     buffer_offset < size;
	     buffer_offset++ )
	{
		table_index = ( safe_checksum ^ buffer[ buffer_offset ] ) & 0x000000ffUL;

		safe_checksum = libfmapi_checksum_crc32_table[ table_index ] ^ ( safe_checksum >> 8 );
        }
	*checksum = safe_checksum;

        return( 1 );
}


int libfsfat_allocation_table_initialize(
     libfsfat_allocation_table_t **allocation_table,
     uint32_t total_number_of_clusters,
     libcerror_error_t **error )
{
	static char *function            = "libfsfat_allocation_table_initialize";
	size_t cluster_numbers_data_size = 0;

	if( allocation_table == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid allocation table.",
		 function );

		return( -1 );
	}
	if( *allocation_table != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid allocation table value already set.",
		 function );

		return( -1 );
	}
	if( ( total_number_of_clusters == 0 )
	 || ( total_number_of_clusters > (uint32_t) LIBFSFAT_MAXIMUM_NUMBER_OF_CLUSTERS_IN_FAT ) )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid total number of clusters value out of bounds.",
		 function );

		return( -1 );
	}
	*allocation_table = memory_allocate_structure(
	                     libfsfat_allocation_table_t );

	if( *allocation_table == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create allocation table.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *allocation_table,
	     0,
	     sizeof( libfsfat_allocation_table_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear allocation table.",
		 function );

		memory_free(
		 *allocation_table );

		*allocation_table = NULL;

		return( -1 );
	}
	cluster_numbers_data_size = sizeof( uint32_t ) * total_number_of_clusters;

	( *allocation_table )->cluster_numbers = (uint32_t *) memory_allocate(
	                                                       cluster_numbers_data_size );

	if( ( *allocation_table )->cluster_numbers == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create cluster numbers.",
		 function );

		goto on_error;
	}
	( *allocation_table )->number_of_cluster_numbers = total_number_of_clusters;

	if( memory_set(
	     ( *allocation_table )->cluster_numbers,
	     0,
	     cluster_numbers_data_size ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear cluster numbers.",
		 function );

		goto on_error;
	}
	return( 1 );

on_error:
	if( *allocation_table != NULL )
	{
		if( ( *allocation_table )->cluster_numbers != NULL )
		{
			memory_free(
			 ( *allocation_table )->cluster_numbers );
		}
		memory_free(
		 *allocation_table );

		*allocation_table = NULL;
	}
	return( -1 );
}


int libfsfat_block_tree_node_initialize(
     libfsfat_block_tree_node_t **block_tree_node,
     off64_t offset,
     size64_t size,
     size64_t leaf_value_size,
     libcerror_error_t **error )
{
	static char *function  = "libfsfat_block_tree_node_initialize";
	size64_t sub_node_size = 0;

	if( block_tree_node == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid block tree node.",
		 function );

		return( -1 );
	}
	if( *block_tree_node != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid block tree node value already set.",
		 function );

		return( -1 );
	}
	if( offset < 0 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid offset value out of bounds.",
		 function );

		return( -1 );
	}
	if( ( size == 0 )
	 || ( size > (size64_t) ( INT64_MAX - offset ) ) )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid size value out of bounds.",
		 function );

		return( -1 );
	}
	if( leaf_value_size == 0 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid leaf value size value out of bounds.",
		 function );

		return( -1 );
	}
	*block_tree_node = memory_allocate_structure(
	                    libfsfat_block_tree_node_t );

	if( *block_tree_node == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create block tree node.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *block_tree_node,
	     0,
	     sizeof( libfsfat_block_tree_node_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear block tree node.",
		 function );

		memory_free(
		 *block_tree_node );

		*block_tree_node = NULL;

		return( -1 );
	}
	if( libcdata_array_initialize(
	     &( ( *block_tree_node )->sub_nodes_array ),
	     LIBFSFAT_BLOCK_TREE_NUMBER_OF_SUB_NODES,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create sub nodes array.",
		 function );

		goto on_error;
	}
	sub_node_size = leaf_value_size;

	while( ( size / sub_node_size ) > LIBFSFAT_BLOCK_TREE_NUMBER_OF_SUB_NODES )
	{
		sub_node_size *= LIBFSFAT_BLOCK_TREE_NUMBER_OF_SUB_NODES;
	}
	( *block_tree_node )->start_offset  = offset;
	( *block_tree_node )->end_offset    = offset + size;
	( *block_tree_node )->size          = size;
	( *block_tree_node )->sub_node_size = sub_node_size;

	if( sub_node_size == leaf_value_size )
	{
		( *block_tree_node )->is_leaf_node = 1;
	}
	return( 1 );

on_error:
	if( *block_tree_node != NULL )
	{
		memory_free(
		 *block_tree_node );

		*block_tree_node = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x204

Cannot access memory at address 0x204


int libfsext_checksum_calculate_crc32(
     uint32_t *checksum,
     const uint8_t *buffer,
     size_t size,
     uint32_t initial_value,
     libcerror_error_t **error )
{
	static char *function  = "libfsext_checksum_calculate_crc32";
	size_t buffer_offset   = 0;
	uint32_t safe_checksum = 0;
	uint32_t table_index   = 0;

	if( checksum == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid checksum.",
		 function );

		return( -1 );
	}
	if( buffer == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid buffer.",
		 function );

		return( -1 );
	}
	if( size > (size_t) SSIZE_MAX )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid size value exceeds maximum.",
		 function );

		return( -1 );
	}
        if( libfsext_checksum_crc32_table_computed == 0 )
	{
		libfsext_checksum_initialize_crc32_table(
		 0x82f63b78UL );
	}
	safe_checksum = initial_value ^ (uint32_t) 0xffffffffUL;

        for( buffer_offset = 0;
	     buffer_offset < size;
	     buffer_offset++ )
	{
		table_index = ( safe_checksum ^ buffer[ buffer_offset ] ) & 0x000000ffUL;

		safe_checksum = libfsext_checksum_crc32_table[ table_index ] ^ ( safe_checksum >> 8 );
        }
        *checksum = safe_checksum ^ 0xffffffffUL;

	return( 1 );
}


int libuna_utf8_string_size_from_utf8_stream(
     const uint8_t *utf8_stream,
     size_t utf8_stream_size,
     size_t *utf8_string_size,
     libcerror_error_t **error )
{
	static char *function                        = "libuna_utf8_string_size_from_utf8_stream";
	size_t utf8_stream_index                     = 0;
	libuna_unicode_character_t unicode_character = 0;

	if( utf8_stream == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid UTF-8 stream.",
		 function );

		return( -1 );
	}
	if( utf8_stream_size > (size_t) SSIZE_MAX )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
		 "%s: invalid UTF-8 stream size value exceeds maximum.",
		 function );

		return( -1 );
	}
	if( utf8_string_size == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid UTF-8 string size.",
		 function );

		return( -1 );
	}
	*utf8_string_size = 0;

	if( utf8_stream_size == 0 )
	{
		return( 1 );
	}

	if( utf8_stream_size >= 3 )
	{
		if( ( utf8_stream[ 0 ] == 0x0ef )
		 && ( utf8_stream[ 1 ] == 0x0bb )
		 && ( utf8_stream[ 2 ] == 0x0bf ) )
		{
			utf8_stream_index += 3;
		}
	}
	while( utf8_stream_index < utf8_stream_size )
	{

		if( libuna_unicode_character_copy_from_utf8(
		     &unicode_character,
		     utf8_stream,
		     utf8_stream_size,
		     &utf8_stream_index,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_CONVERSION,
			 LIBCERROR_CONVERSION_ERROR_INPUT_FAILED,
			 "%s: unable to copy Unicode character from UTF-8 stream.",
			 function );

			return( -1 );
		}

		if( libuna_unicode_character_size_to_utf8(
		     unicode_character,
		     utf8_string_size,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_CONVERSION,
			 LIBCERROR_CONVERSION_ERROR_INPUT_FAILED,
			 "%s: unable to unable to determine size of Unicode character in UTF-8.",
			 function );

			return( -1 );
		}
		if( unicode_character == 0 )
		{
			break;
		}
	}

	if( unicode_character != 0 )
	{
		*utf8_string_size += 1;
	}
	return( 1 );
}

Cannot access memory at address 0x200


int libfsntfs_mft_entry_initialize(
     libfsntfs_mft_entry_t **mft_entry,
     libcerror_error_t **error )
{
	static char *function = "libfsntfs_mft_entry_initialize";

	if( mft_entry == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid MFT entry.",
		 function );

		return( -1 );
	}
	if( *mft_entry != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid MFT entry value already set.",
		 function );

		return( -1 );
	}
	*mft_entry = memory_allocate_structure(
	              libfsntfs_mft_entry_t );

	if( *mft_entry == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create MFT entry.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *mft_entry,
	     0,
	     sizeof( libfsntfs_mft_entry_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear MFT entry.",
		 function );

		memory_free(
		 *mft_entry );

		*mft_entry = NULL;

		return( -1 );
	}
	if( libcdata_array_initialize(
	     &( ( *mft_entry )->attributes_array ),
	     0,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create attributes array.",
		 function );

		goto on_error;
	}
	if( libcdata_array_initialize(
	     &( ( *mft_entry )->alternate_data_attributes_array ),
	     0,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create alternate data attributes array.",
		 function );

		goto on_error;
	}
	( *mft_entry )->file_name_attribute_index            = -1;
	( *mft_entry )->reparse_point_attribute_index        = -1;
	( *mft_entry )->security_descriptor_attribute_index  = -1;
	( *mft_entry )->standard_information_attribute_index = -1;
	( *mft_entry )->volume_information_attribute_index   = -1;
	( *mft_entry )->volume_name_attribute_index          = -1;

	return( 1 );

on_error:
	if( *mft_entry != NULL )
	{
		if( ( *mft_entry )->alternate_data_attributes_array != NULL )
		{
			libcdata_array_free(
			 &( ( *mft_entry )->alternate_data_attributes_array ),
			 NULL,
			 NULL );
		}
		if( ( *mft_entry )->attributes_array != NULL )
		{
			libcdata_array_free(
			 &( ( *mft_entry )->attributes_array ),
			 NULL,
			 NULL );
		}
		memory_free(
		 *mft_entry );

		*mft_entry = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0xffffffffffffffff


int libevtx_io_handle_initialize(
     libevtx_io_handle_t **io_handle,
     libcerror_error_t **error )
{
	static char *function = "libevtx_io_handle_initialize";

	if( io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid IO handle.",
		 function );

		return( -1 );
	}
	if( *io_handle != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid IO handle value already set.",
		 function );

		return( -1 );
	}
	*io_handle = memory_allocate_structure(
	              libevtx_io_handle_t );

	if( *io_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create IO handle.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *io_handle,
	     0,
	     sizeof( libevtx_io_handle_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear IO handle.",
		 function );

		goto on_error;
	}
	( *io_handle )->chunk_size     = 0x00010000UL;
	( *io_handle )->ascii_codepage = LIBEVTX_CODEPAGE_WINDOWS_1252;

	return( 1 );

on_error:
	if( *io_handle != NULL )
	{
		memory_free(
		 *io_handle );

		*io_handle = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x1004c6f20

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x18

Cannot access memory at address 0x18


int libfdata_stream_initialize(
     libfdata_stream_t **stream,
     intptr_t *data_handle,
     int (*free_data_handle)(
            intptr_t **data_handle,
            libcerror_error_t **error ),
     int (*clone_data_handle)(
            intptr_t **destination_data_handle,
            intptr_t *source_data_handle,
            libcerror_error_t **error ),
     int (*create_segment)(
            intptr_t *data_handle,
            intptr_t *file_io_handle,
            int segment_index,
            int *segment_file_index,
            off64_t *segment_offset,
            size64_t *segment_size,
            uint32_t *segment_flags,
            libcerror_error_t **error ),
     ssize_t (*read_segment_data)(
                intptr_t *data_handle,
                intptr_t *file_io_handle,
                int segment_index,
                int segment_file_index,
                uint8_t *segment_data,
                size_t segment_data_size,
                uint32_t segment_flags,
                uint8_t read_flags,
                libcerror_error_t **error ),
     ssize_t (*write_segment_data)(
                intptr_t *data_handle,
                intptr_t *file_io_handle,
                int segment_index,
                int segment_file_index,
                const uint8_t *segment_data,
                size_t segment_data_size,
                uint32_t segment_flags,
                uint8_t write_flags,
                libcerror_error_t **error ),
     off64_t (*seek_segment_offset)(
                intptr_t *data_handle,
                intptr_t *file_io_handle,
                int segment_index,
                int segment_file_index,
                off64_t segment_offset,
                libcerror_error_t **error ),
     uint8_t flags,
     libcerror_error_t **error )
{
	libfdata_internal_stream_t *internal_stream = NULL;
	static char *function                       = "libfdata_stream_initialize";

	if( stream == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid stream.",
		 function );

		return( -1 );
	}
	if( *stream != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid stream value already set.",
		 function );

		return( -1 );
	}
	if( ( flags & 0xfe ) != 0 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
		 "%s: unsupported flags: 0x%02" PRIx8 ".",
		 function );

		return( -1 );
	}
	internal_stream = memory_allocate_structure(
	                   libfdata_internal_stream_t );

	if( internal_stream == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create stream.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     internal_stream,
	     0,
	     sizeof( libfdata_internal_stream_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear stream.",
		 function );

		memory_free(
		 internal_stream );

		return( -1 );
	}
	if( libcdata_array_initialize(
	     &( internal_stream->segments_array ),
	     0,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create segments array.",
		 function );

		goto on_error;
	}
	if( libcdata_array_initialize(
	     &( internal_stream->mapped_ranges_array ),
	     0,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create mapped ranges array.",
		 function );

		goto on_error;
	}
	internal_stream->segment_offset      = -1;
	internal_stream->flags              |= flags;
	internal_stream->data_handle         = data_handle;
	internal_stream->free_data_handle    = free_data_handle;
	internal_stream->clone_data_handle   = clone_data_handle;
	internal_stream->create_segment      = create_segment;
	internal_stream->read_segment_data   = read_segment_data;
	internal_stream->write_segment_data  = write_segment_data;
	internal_stream->seek_segment_offset = seek_segment_offset;

	*stream = (libfdata_stream_t *) internal_stream;

	return( 1 );

on_error:
	if( internal_stream != NULL )
	{
		if( internal_stream->segments_array != NULL )
		{
			libcdata_array_free(
			 &( internal_stream->segments_array ),
			 NULL,
			 NULL );
		}
		memory_free(
		 internal_stream );
	}
	return( -1 );
}

internal_stream->segment_offset      = -1;

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x5b0000006e


int libfdata_segments_array_set_segment_by_index(
     libcdata_array_t *segments_array,
     libcdata_array_t *mapped_ranges_array,
     size64_t *data_size,
     int segment_index,
     int segment_file_index,
     off64_t segment_offset,
     size64_t segment_size,
     uint32_t segment_flags,
     libcerror_error_t **error )
{
	libfdata_mapped_range_t *mapped_range = NULL;
	libfdata_range_t *segment_data_range  = NULL;
	static char *function                 = "libfdata_segments_array_set_segment_by_index";
	off64_t previous_segment_offset       = 0;
	size64_t previous_segment_size        = 0;
	uint32_t previous_segment_flags       = 0;
	int previous_segment_file_index       = 0;

	if( data_size == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid data size.",
		 function );

		return( -1 );
	}
	if( segment_file_index < 0 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid segment file index value out of bounds.",
		 function );

		return( -1 );
	}
	if( segment_offset < 0 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
		 "%s: invalid segment offset value out of bounds.",
		 function );

		return( -1 );
	}
	if( libcdata_array_get_entry_by_index(
	     segments_array,
	     segment_index,
	     (intptr_t **) &segment_data_range,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve entry: %d from segments array.",
		 function,
		 segment_index );

		return( -1 );
	}
	if( segment_data_range == NULL )
	{
		if( libfdata_range_initialize(
		     &segment_data_range,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
			 "%s: unable to create segment data range.",
			 function );

			return( -1 );
		}
		if( libcdata_array_set_entry_by_index(
		     segments_array,
		     segment_index,
		     (intptr_t *) segment_data_range,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
			 "%s: unable to set entry: %d to segments array.",
			 function,
			 segment_index );

			libfdata_range_free(
			 &segment_data_range,
			 NULL );

			return( -1 );
		}
	}
	else
	{
		if( libfdata_range_get(
		     segment_data_range,
		     &previous_segment_file_index,
		     &previous_segment_offset,
		     &previous_segment_size,
		     &previous_segment_flags,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
			 "%s: unable to retrieve segment: %d data range values.",
			 function,
			 segment_index );

			return( -1 );
		}
		*data_size -= previous_segment_size;
	}
	if( libfdata_range_set(
	     segment_data_range,
	     segment_file_index,
	     segment_offset,
	     segment_size,
	     segment_flags,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
		 "%s: unable to set segment data range values.",
		 function );

		return( -1 );
	}

	if( libcdata_array_get_entry_by_index(
	     mapped_ranges_array,
	     segment_index,
	     (intptr_t **) &mapped_range,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve entry: %d from mapped ranges array.",
		 function,
		 segment_index );

		return( -1 );
	}
	if( mapped_range == NULL )
	{
		if( libfdata_mapped_range_initialize(
		     &mapped_range,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
			 "%s: unable to create mapped range.",
			 function );

			return( -1 );
		}
		if( libcdata_array_set_entry_by_index(
		     mapped_ranges_array,
		     segment_index,
		     (intptr_t *) mapped_range,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_SET_FAILED,
			 "%s: unable to set entry: %d in mapped ranges array.",
			 function,
			 segment_index );

			libfdata_mapped_range_free(
			 &mapped_range,
			 NULL );

			return( -1 );
		}
	}
	*data_size += segment_size;

	return( 1 );
}

size64_t previous_segment_size        = 0;

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x1004fb7c6


int libfdata_range_initialize(
     libfdata_range_t **range,
     libcerror_error_t **error )
{
	static char *function = "libfdata_range_initialize";

	if( range == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid range.",
		 function );

		return( -1 );
	}
	if( *range != NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET,
		 "%s: invalid range value already set.",
		 function );

		return( -1 );
	}
	*range = memory_allocate_structure(
	          libfdata_range_t );

	if( *range == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
		 "%s: unable to create range.",
		 function );

		goto on_error;
	}
	if( memory_set(
	     *range,
	     0,
	     sizeof( libfdata_range_t ) ) == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_MEMORY,
		 LIBCERROR_MEMORY_ERROR_SET_FAILED,
		 "%s: unable to clear range.",
		 function );

		goto on_error;
	}
	( *range )->file_index = -1;
	( *range )->offset     = (off64_t) -1;

	return( 1 );

on_error:
	if( *range != NULL )
	{
		memory_free(
		 *range );

		*range = NULL;
	}
	return( -1 );
}

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x858bffffff608d8b

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x100000010


int libagdb_compressed_blocks_stream_initialize(
     libfdata_stream_t **compressed_blocks_stream,
     libfdata_list_t *compressed_blocks_list,
     libfcache_cache_t *compressed_blocks_cache,
     libcerror_error_t **error )
{
	libagdb_compressed_blocks_stream_data_handle_t *data_handle = NULL;
	static char *function                                       = "libagdb_compressed_blocks_stream_initialize";
	off64_t segment_offset                                      = 0;
	size64_t segment_size                                       = 0;
	int element_index                                           = 0;
	int number_of_elements                                      = 0;
	int segment_index                                           = 0;

	if( compressed_blocks_stream == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid compressed block stream.",
		 function );

		return( -1 );
	}
	if( compressed_blocks_list == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
		 LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
		 "%s: invalid compressed blocks list.",
		 function );

		return( -1 );
	}
	if( libagdb_compressed_blocks_stream_data_handle_initialize(
	     &data_handle,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create data handle.",
		 function );

		goto on_error;
	}
	if( data_handle == NULL )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_VALUE_MISSING,
		 "%s: missing data handle.",
		 function );

		goto on_error;
	}
	data_handle->compressed_blocks_list  = compressed_blocks_list;
	data_handle->compressed_blocks_cache = compressed_blocks_cache;

	if( libfdata_stream_initialize(
	     compressed_blocks_stream,
	     (intptr_t *) data_handle,
	     (int (*)(intptr_t **, libcerror_error_t **)) &libagdb_compressed_blocks_stream_data_handle_free,
	     NULL,
	     NULL,
	     (ssize_t (*)(intptr_t *, intptr_t *, int, int, uint8_t *, size_t, uint32_t, uint8_t, libcerror_error_t **)) &libagdb_compressed_blocks_stream_data_handle_read_segment_data,
	     NULL,
	     (off64_t (*)(intptr_t *, intptr_t *, int, int, off64_t, libcerror_error_t **)) &libagdb_compressed_blocks_stream_data_handle_seek_segment_offset,
	     LIBFDATA_DATA_HANDLE_FLAG_MANAGED,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_INITIALIZE_FAILED,
		 "%s: unable to create stream.",
		 function );

		goto on_error;
	}
	if( libfdata_list_get_number_of_elements(
	     compressed_blocks_list,
	     &number_of_elements,
	     error ) != 1 )
	{
		libcerror_error_set(
		 error,
		 LIBCERROR_ERROR_DOMAIN_RUNTIME,
		 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
		 "%s: unable to retrieve number of compressed blocks list elements.",
		 function );

		data_handle = NULL;

		goto on_error;
	}
	for( element_index = 0;
	     element_index < number_of_elements;
	     element_index++ )
	{
		if( libfdata_list_get_mapped_size_by_index(
		     compressed_blocks_list,
		     element_index,
		     &segment_size,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_GET_FAILED,
			 "%s: unable to retrieve compressed blocks list element: %d mapped size.",
			 function,
			 element_index );

			data_handle = NULL;

			goto on_error;
		}
		if( libfdata_stream_append_segment(
		     *compressed_blocks_stream,
		     &segment_index,
		     0,
		     segment_offset,
		     segment_size,
		     0,
		     error ) != 1 )
		{
			libcerror_error_set(
			 error,
			 LIBCERROR_ERROR_DOMAIN_RUNTIME,
			 LIBCERROR_RUNTIME_ERROR_APPEND_FAILED,
			 "%s: unable to append compressed blocks stream segment: %d.",
			 function,
			 element_index );

			data_handle = NULL;

			goto on_error;
		}
		segment_offset += segment_size;
	}
	return( 1 );

on_error:
	if( *compressed_blocks_stream != NULL )
	{
		libfdata_stream_free(
		 compressed_blocks_stream,
		 NULL );
	}
	if( data_handle != NULL )
	{
		libagdb_compressed_blocks_stream_data_handle_free(
		 &data_handle,
		 NULL );
	}
	return( -1 );
}

int number_of_elements                                      = 0;

Traceback (most recent call last):
  File "/tracer/var_utils.py", line 72, in serialize_value_to_json
    if str(value) == "0x0":
gdb.MemoryError: Cannot access memory at address 0x801087060