Skip to content
Snippets Groups Projects
Commit 6dc92ae9 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

variables extension: fixed segfault bug triggered when dumping binary variable scopes.

parent 68c89690
No related branches found
No related tags found
No related merge requests found
......@@ -164,7 +164,7 @@ struct ext_include_ast_context *ext_include_create_ast_context
sieve_variable_scope_ref(actx->global_vars);
} else {
actx->global_vars = sieve_variable_scope_create(this_ext);
actx->global_vars = sieve_variable_scope_create(this_ext->svinst, this_ext);
}
sieve_ast_extension_register
......
......@@ -42,10 +42,11 @@ struct sieve_variable_scope {
pool_t pool;
int refcount;
struct sieve_variable *error_var;
struct sieve_instance *svinst;
const struct sieve_extension *ext;
struct sieve_variable *error_var;
struct hash_table *variables;
ARRAY_DEFINE(variable_index, struct sieve_variable *);
};
......@@ -64,7 +65,7 @@ struct sieve_variable_scope_iter {
};
struct sieve_variable_scope *sieve_variable_scope_create
(const struct sieve_extension *ext)
(struct sieve_instance *svinst, const struct sieve_extension *ext)
{
struct sieve_variable_scope *scope;
pool_t pool;
......@@ -74,6 +75,7 @@ struct sieve_variable_scope *sieve_variable_scope_create
scope->pool = pool;
scope->refcount = 1;
scope->svinst = svinst;
scope->ext = ext;
scope->variables = hash_table_create
......@@ -234,7 +236,7 @@ struct sieve_variable *sieve_variable_scope_get_indexed
/* Scope binary */
struct sieve_variable_scope *sieve_variable_scope_binary_dump
(const struct sieve_extension *ext,
(struct sieve_instance *svinst, const struct sieve_extension *ext,
const struct sieve_dumptime_env *denv, sieve_size_t *address)
{
struct sieve_variable_scope *local_scope;
......@@ -253,7 +255,7 @@ struct sieve_variable_scope *sieve_variable_scope_binary_dump
return FALSE;
/* Create scope */
local_scope = sieve_variable_scope_create(ext);
local_scope = sieve_variable_scope_create(svinst, ext);
/* Read and dump scope itself */
......@@ -336,7 +338,7 @@ struct sieve_variable_scope_binary *sieve_variable_scope_binary_read
}
/* Create scope */
scope = sieve_variable_scope_create(ext);
scope = sieve_variable_scope_create(svinst, ext);
scpbin = sieve_variable_scope_binary_create(scope);
scpbin->size = scope_size;
......@@ -352,7 +354,7 @@ struct sieve_variable_scope *sieve_variable_scope_binary_get
(struct sieve_variable_scope_binary *scpbin)
{
const struct sieve_extension *ext = scpbin->scope->ext;
struct sieve_instance *svinst = ext->svinst;
struct sieve_instance *svinst = scpbin->scope->svinst;
const char *ext_name =
( ext == NULL ? "variables" : sieve_extension_name(ext) );
unsigned int i;
......@@ -551,7 +553,7 @@ static struct sieve_variable_scope *ext_variables_create_local_scope
{
struct sieve_variable_scope *scope;
scope = sieve_variable_scope_create(NULL);
scope = sieve_variable_scope_create(this_ext->svinst, NULL);
sieve_ast_extension_register
(ast, this_ext, &variables_ast_extension, (void *) scope);
......
......@@ -73,7 +73,8 @@ bool ext_variables_code_dump
struct ext_variables_dump_context *dctx;
struct sieve_variable_scope *local_scope;
local_scope = sieve_variable_scope_binary_dump(NULL, denv, address);
local_scope = sieve_variable_scope_binary_dump
(ext->svinst, NULL, denv, address);
dctx = ext_variables_dump_get_context(ext, denv);
dctx->local_scope = local_scope;
......
......@@ -63,7 +63,7 @@ struct sieve_variable {
struct sieve_variable_scope;
struct sieve_variable_scope *sieve_variable_scope_create
(const struct sieve_extension *ext);
(struct sieve_instance *svinst, const struct sieve_extension *ext);
void sieve_variable_scope_ref
(struct sieve_variable_scope *scope);
void sieve_variable_scope_unref
......@@ -91,7 +91,7 @@ void sieve_variable_scope_binary_unref
(struct sieve_variable_scope_binary **scpbin);
struct sieve_variable_scope *sieve_variable_scope_binary_dump
(const struct sieve_extension *ext,
(struct sieve_instance *svinst, const struct sieve_extension *ext,
const struct sieve_dumptime_env *denv, sieve_size_t *address);
struct sieve_variable_scope_binary *sieve_variable_scope_binary_read
(struct sieve_instance *svinst, const struct sieve_extension *ext,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.