Git versions prior to 2.54.1-1.oe2403sp4 contain a heap buffer overflow vulnerability in the three-way merge code triggered by specially crafted repository data. This overflow occurs due to a 32-bit signed integer wrap when calculating the size of merged output with large conflict-marker-size attributes, potentially leading to heap corruption or crashes. The flaw can be exploited by an attacker controlling a repository, affecting commands that perform textual three-way merges such as git-merge, git-rebase, git-cherry-pick, and git-merge-tree. A patch is available that fixes the issue by using size_t for size calculations and checking for overflow. Workarounds include limiting conflict-marker-size or disabling server-side mergeability checks for untrusted repositories.