Skip to content

object-file: use size_t for object size in check_object_signature() - #6415

Merged
dscho merged 1 commit into
git-for-windows:mainfrom
i80487:fix/change-unsigned-long-to-size-t
Sep 17, 2026
Merged

dscho merged 1 commit into
git-for-windows:mainfrom
i80487:fix/change-unsigned-long-to-size-t

Conversation

@i80487

@i80487 i80487 commented Sep 15, 2026

Copy link
Copy Markdown

check_object_signature() function prototype defines size parameter as an unsigned long. However, it receives size as size_t from its current callers and forwards it unchanged to hash_object_file(), which expects size_t. Using size_t here keeps the types consistent and avoids an implicit narrowing conversion to unsigned long, which may truncate values when size >= 2^32 on Windows (an unsigned long is 32-bit while a size_t is 64-bit).

Signed-off-by: David PRUDHOMME <david7.prudhomme@gmail.com>

@dscho dscho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@dscho
dscho merged commit f0c9c06 into git-for-windows:main Sep 17, 2026
116 of 117 checks passed
@dscho dscho added this to the Next release milestone Sep 17, 2026
gitforwindowshelper Bot pushed a commit that referenced this pull request Sep 17, 2026
…6415)

`check_object_signature()` function prototype defines `size` parameter
as an `unsigned long`. However, it receives `size` as `size_t` from its
current callers and forwards it unchanged to `hash_object_file()`, which
expects `size_t`. Using `size_t` here keeps the types consistent and
avoids an implicit narrowing conversion to `unsigned long`, which may
truncate values when `size >= 2^32` on Windows (an `unsigned long` is
32-bit while a `size_t` is 64-bit).
gitforwindowshelper Bot pushed a commit that referenced this pull request Sep 17, 2026
…6415)

`check_object_signature()` function prototype defines `size` parameter
as an `unsigned long`. However, it receives `size` as `size_t` from its
current callers and forwards it unchanged to `hash_object_file()`, which
expects `size_t`. Using `size_t` here keeps the types consistent and
avoids an implicit narrowing conversion to `unsigned long`, which may
truncate values when `size >= 2^32` on Windows (an `unsigned long` is
32-bit while a `size_t` is 64-bit).
gitforwindowshelper Bot pushed a commit that referenced this pull request Sep 17, 2026
…6415)

`check_object_signature()` function prototype defines `size` parameter
as an `unsigned long`. However, it receives `size` as `size_t` from its
current callers and forwards it unchanged to `hash_object_file()`, which
expects `size_t`. Using `size_t` here keeps the types consistent and
avoids an implicit narrowing conversion to `unsigned long`, which may
truncate values when `size >= 2^32` on Windows (an `unsigned long` is
32-bit while a `size_t` is 64-bit).
gitforwindowshelper Bot pushed a commit that referenced this pull request Sep 18, 2026
…6415)

`check_object_signature()` function prototype defines `size` parameter
as an `unsigned long`. However, it receives `size` as `size_t` from its
current callers and forwards it unchanged to `hash_object_file()`, which
expects `size_t`. Using `size_t` here keeps the types consistent and
avoids an implicit narrowing conversion to `unsigned long`, which may
truncate values when `size >= 2^32` on Windows (an `unsigned long` is
32-bit while a `size_t` is 64-bit).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants