https://github.com/git/git
Revision 0227130244c007870c106fc613903d078730e45c authored by Johannes Schindelin on 12 January 2023, 00:05:02 UTC, committed by Junio C Hamano on 19 January 2023, 21:38:06 UTC
On platforms where `size_t` does not have the same width as `unsigned
long`, passing a pointer to the former when a pointer to the latter is
expected can lead to problems.

Windows and 32-bit Linux are among the affected platforms.

In this instance, we want to store the size of the blob that was read in
that variable. However, `read_blob_data_from_index()` passes that
pointer to `read_object_file()` which expects an `unsigned long *`.
Which means that on affected platforms, the variable is not fully
populated and part of its value is left uninitialized. (On Big-Endian
platforms, this problem would be even worse.)

The consequence is that depending on the uninitialized memory's
contents, we may erroneously reject perfectly fine attributes.

Let's address this by passing a pointer to a variable of the expected
data type.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b7b37a3
History
Tip revision: 0227130244c007870c106fc613903d078730e45c authored by Johannes Schindelin on 12 January 2023, 00:05:02 UTC
attr: adjust a mismatched data type
Tip revision: 0227130
File Mode Size
xdiff.h -rw-r--r-- 3.8 KB
xdiffi.c -rw-r--r-- 28.0 KB
xdiffi.h -rw-r--r-- 1.9 KB
xemit.c -rw-r--r-- 7.9 KB
xemit.h -rw-r--r-- 1.2 KB
xhistogram.c -rw-r--r-- 9.4 KB
xinclude.h -rw-r--r-- 1.1 KB
xmacros.h -rw-r--r-- 1.9 KB
xmerge.c -rw-r--r-- 17.0 KB
xpatience.c -rw-r--r-- 10.6 KB
xprepare.c -rw-r--r-- 12.0 KB
xprepare.h -rw-r--r-- 1.0 KB
xtypes.h -rw-r--r-- 1.5 KB
xutils.c -rw-r--r-- 9.6 KB
xutils.h -rw-r--r-- 1.7 KB

back to top