mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-27 22:28:38 -05:00
read-cache: stop truncating index blob sizes on Windows
Continue the size_t evacuation. read_blob_data_from_index() reads the blob through the size_t odb_read_object() API but writes the size back through an unsigned long out-parameter, silently truncating anything past 4 GiB on Windows. Widen the out-parameter, drop the cast_size_t_to_ulong() shim, and move the matching locals in the two convert.c callers and the one in attr.c. Their downstream consumers (gather_convert_stats() widened in the prior commit and read_attr_from_buf() already size_t) take the new type directly. Assisted-by: Opus 4.7 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
committed by
Git for Windows Build Agent
parent
ec7073bbf1
commit
fc044dac30
@@ -793,7 +793,7 @@ static struct attr_stack *read_attr_from_index(struct index_state *istate,
|
||||
{
|
||||
struct attr_stack *stack = NULL;
|
||||
char *buf;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
int sparse_dir_pos = -1;
|
||||
|
||||
if (!istate)
|
||||
|
||||
@@ -141,7 +141,7 @@ const char *get_cached_convert_stats_ascii(struct index_state *istate,
|
||||
const char *path)
|
||||
{
|
||||
const char *ret;
|
||||
unsigned long sz;
|
||||
size_t sz;
|
||||
void *data = read_blob_data_from_index(istate, path, &sz);
|
||||
ret = gather_convert_stats_ascii(data, sz);
|
||||
free(data);
|
||||
@@ -223,7 +223,7 @@ static void check_global_conv_flags_eol(const char *path,
|
||||
|
||||
static int has_crlf_in_index(struct index_state *istate, const char *path)
|
||||
{
|
||||
unsigned long sz;
|
||||
size_t sz;
|
||||
void *data;
|
||||
const char *crp;
|
||||
int has_crlf = 0;
|
||||
|
||||
@@ -412,7 +412,7 @@ int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
|
||||
int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);
|
||||
void set_object_name_for_intent_to_add_entry(struct cache_entry *ce);
|
||||
int index_name_is_other(struct index_state *, const char *, int);
|
||||
void *read_blob_data_from_index(struct index_state *, const char *, unsigned long *);
|
||||
void *read_blob_data_from_index(struct index_state *, const char *, size_t *);
|
||||
|
||||
/* do stat comparison even if CE_VALID is true */
|
||||
#define CE_MATCH_IGNORE_VALID 01
|
||||
|
||||
@@ -3473,7 +3473,7 @@ int index_name_is_other(struct index_state *istate, const char *name,
|
||||
}
|
||||
|
||||
void *read_blob_data_from_index(struct index_state *istate,
|
||||
const char *path, unsigned long *size)
|
||||
const char *path, size_t *size)
|
||||
{
|
||||
int pos, len;
|
||||
size_t sz;
|
||||
@@ -3504,7 +3504,7 @@ void *read_blob_data_from_index(struct index_state *istate,
|
||||
return NULL;
|
||||
}
|
||||
if (size)
|
||||
*size = cast_size_t_to_ulong(sz);
|
||||
*size = sz;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user