Print this page
12257 resync smatch to 0.6.1-rc1-il-4
*** 48,58 ****
#include <openssl/md5.h>
static int my_id;
! static mtag_t str_to_tag(const char *str)
{
unsigned char c[MD5_DIGEST_LENGTH];
unsigned long long *tag = (unsigned long long *)&c;
MD5_CTX mdContext;
int len;
--- 48,58 ----
#include <openssl/md5.h>
static int my_id;
! mtag_t str_to_mtag(const char *str)
{
unsigned char c[MD5_DIGEST_LENGTH];
unsigned long long *tag = (unsigned long long *)&c;
MD5_CTX mdContext;
int len;
*** 130,140 ****
return state;
right_name = expr_to_str(right);
snprintf(buf, sizeof(buf), "%s %s %s %s", get_filename(), get_function(),
left_name, right_name);
! tag = str_to_tag(buf);
tag_sval.type = estate_type(state);
tag_sval.uvalue = tag;
rl = rl_filter(estate_rl(state), valid_ptr_rl);
rl = clone_rl(rl);
--- 130,140 ----
return state;
right_name = expr_to_str(right);
snprintf(buf, sizeof(buf), "%s %s %s %s", get_filename(), get_function(),
left_name, right_name);
! tag = str_to_mtag(buf);
tag_sval.type = estate_type(state);
tag_sval.uvalue = tag;
rl = rl_filter(estate_rl(state), valid_ptr_rl);
rl = clone_rl(rl);
*** 154,165 ****
if (expr->type != EXPR_STRING || !expr->string)
return 0;
/* I was worried about collisions so I added a xor */
! xor = str_to_tag("__smatch string");
! *tag = str_to_tag(expr->string->data);
*tag = *tag ^ xor;
return 1;
}
--- 154,165 ----
if (expr->type != EXPR_STRING || !expr->string)
return 0;
/* I was worried about collisions so I added a xor */
! xor = str_to_mtag("__smatch string");
! *tag = str_to_mtag(expr->string->data);
*tag = *tag ^ xor;
return 1;
}
*** 175,185 ****
return 0;
snprintf(buf, sizeof(buf), "%s %s",
(sym->ctype.modifiers & MOD_STATIC) ? get_filename() : "extern",
sym->ident->name);
! *tag = str_to_tag(buf);
return 1;
}
bool get_symbol_mtag(struct symbol *sym, mtag_t *tag)
{
--- 175,185 ----
return 0;
snprintf(buf, sizeof(buf), "%s %s",
(sym->ctype.modifiers & MOD_STATIC) ? get_filename() : "extern",
sym->ident->name);
! *tag = str_to_mtag(buf);
return 1;
}
bool get_symbol_mtag(struct symbol *sym, mtag_t *tag)
{
*** 194,204 ****
if (get_param_num_from_sym(sym) >= 0)
return false;
snprintf(buf, sizeof(buf), "%s %s %s",
get_filename(), get_function(), sym->ident->name);
! *tag = str_to_tag(buf);
return true;
}
static void global_variable(struct symbol *sym)
{
--- 194,204 ----
if (get_param_num_from_sym(sym) >= 0)
return false;
snprintf(buf, sizeof(buf), "%s %s %s",
get_filename(), get_function(), sym->ident->name);
! *tag = str_to_mtag(buf);
return true;
}
static void global_variable(struct symbol *sym)
{
*** 256,266 ****
return rl;
name = expr_to_str(expr);
snprintf(buf, sizeof(buf), "%s %s %s", get_filename(), get_function(), name);
free_string(name);
! tag = str_to_tag(buf);
sval.value = tag;
return alloc_rl(sval, sval);
}
int create_mtag_alias(mtag_t tag, struct expression *expr, mtag_t *new)
--- 256,266 ----
return rl;
name = expr_to_str(expr);
snprintf(buf, sizeof(buf), "%s %s %s", get_filename(), get_function(), name);
free_string(name);
! tag = str_to_mtag(buf);
sval.value = tag;
return alloc_rl(sval, sval);
}
int create_mtag_alias(mtag_t tag, struct expression *expr, mtag_t *new)
*** 282,292 ****
lines_from_start = expr->pos.line - cur_func_sym->pos.line;
str = expr_to_str(expr);
snprintf(buf, sizeof(buf), "%lld %d %s", tag, lines_from_start, str);
free_string(str);
! *new = str_to_tag(buf);
sql_insert_mtag_alias(tag, *new);
return 1;
}
--- 282,292 ----
lines_from_start = expr->pos.line - cur_func_sym->pos.line;
str = expr_to_str(expr);
snprintf(buf, sizeof(buf), "%lld %d %s", tag, lines_from_start, str);
free_string(str);
! *new = str_to_mtag(buf);
sql_insert_mtag_alias(tag, *new);
return 1;
}