<commit_before>#include "engine.h"
#include "portable.h"
#include "md5.h"

#include <lua.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>

#include "debug.h"
#include "scanner.h"
#include "util.h"
#include "build.h"

#ifdef _MSC_VER
#include <malloc.h> /* alloca */
#define snprintf _snprintf
#endif

#define TD_ANCESTOR_FILE ".tundra-ancestors"

#define TD_STATIC_ASSERT(expr) \
	static const char _static_assert ## __LINE__ [ (expr) ? 1 : -1] = {0}

void td_sign_timestamp(td_engine *engine, td_file *f, td_digest *out)
{
	int zero_size;
	const td_stat *stat;
	stat = td_stat_file(engine, f);

	zero_size = sizeof(out->data) - sizeof(stat->timestamp);

	memcpy(&out->data[0], &stat->timestamp, sizeof(stat->timestamp));
	memset(&out->data[zero_size], 0, zero_size);

	++engine->stats.timestamp_sign_count;
}

void td_sign_digest(td_engine *engine, td_file *file, td_digest *out)
{
	FILE* f;
<commit_msg>Fixed timestamp signer used uninitialized data.<commit_after>#include "engine.h"
#include "portable.h"
#include "md5.h"

#include <lua.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>

#include "debug.h"
#include "scanner.h"
#include "util.h"
#include "build.h"

#ifdef _MSC_VER
#include <malloc.h> /* alloca */
#define snprintf _snprintf
#endif

#define TD_ANCESTOR_FILE ".tundra-ancestors"

#define TD_STATIC_ASSERT(expr) \
	static const char _static_assert ## __LINE__ [ (expr) ? 1 : -1] = {0}

void td_sign_timestamp(td_engine *engine, td_file *f, td_digest *out)
{
	int zero_size;
	const td_stat *stat;
	stat = td_stat_file(engine, f);

	zero_size = sizeof(out->data) - sizeof(stat->timestamp);

	memcpy(&out->data[0], &stat->timestamp, sizeof(stat->timestamp));
	memset(&out->data[sizeof(stat->timestamp)], 0, zero_size);

	++engine->stats.timestamp_sign_count;
}

void td_sign_digest(td_engine *engine, td_file *file, td_digest *out)
{
	FILE* f;

{'fraction_non_alphanumeric': 0.16400797607178463, 'fraction_numerical': 0.005982053838484547, 'mean_word_length': 5.6019736842105265, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3568758', 'n_tokens_mistral': 807, 'n_tokens_neox': 784, 'n_words': 175}