CVE-2018-13347
Description
mpatch.c in Mercurial before 4.6.1 mishandles integer addition and subtraction, aka OVE-20180430-0002.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Mercurial before 4.6.1 mishandles integer addition/subtraction in mpatch.c, leading to a denial-of-service or potential memory corruption.
Vulnerability
An integer handling flaw exists in the mpatch.c file of Mercurial versions prior to 4.6.1 [1]. The vulnerability is due to incorrect handling of integer addition and subtraction operations, which can lead to an integer overflow or underflow [3]. This issue affects all Mercurial releases before the 4.6.1 minor release, which was published on 2018-06-06 [1].
Exploitation
An attacker can trigger the vulnerability by providing a specially crafted input that causes the manipulated integer operations in the mpatch binary diff code to exceed their intended bounds [1][3]. The attack likely requires the target to process a malicious patch or repository operation that invokes the mpatch functionality, potentially through a network clone or pull operation [2].
Impact
Successful exploitation can result in a denial-of-service condition due to application crash or, in some scenarios, memory corruption that could be leveraged for further compromise [3]. The outcome depends on the specific integer miscalculation and its effect on buffer operations within the mpatch code.
Mitigation
The vulnerability is fixed in Mercurial version 4.6.1, released on 2018-06-06 [1]. Users should upgrade to this version or later. Red Hat Enterprise Linux users can apply the fix via RHSA-2019:2276 [2]. No workaround is documented in the available references; applying the patch is the recommended action.
AI Insight generated on May 22, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
mercurialPyPI | < 4.6.1 | 4.6.1 |
Affected products
4- ghsa-coords4 versionspkg:pypi/mercurialpkg:rpm/suse/mercurial&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015pkg:rpm/suse/mercurial&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2011%20SP4pkg:rpm/suse/mercurial&distro=SUSE%20Linux%20Enterprise%20Software%20Development%20Kit%2012%20SP3
< 4.6.1+ 3 more
- (no CPE)range: < 4.6.1
- (no CPE)range: < 4.5.2-3.3.1
- (no CPE)range: < 2.3.2-0.18.9.1
- (no CPE)range: < 2.8.2-15.13.1
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
8- access.redhat.com/errata/RHSA-2019:2276ghsavendor-advisoryx_refsource_REDHATWEB
- github.com/advisories/GHSA-3mjj-mr4f-qxmxghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2018-13347ghsaADVISORY
- github.com/pypa/advisory-database/tree/main/vulns/mercurial/PYSEC-2018-89.yamlghsaWEB
- lists.debian.org/debian-lts-announce/2020/07/msg00032.htmlghsamailing-listx_refsource_MLISTWEB
- www.mercurial-scm.org/repo/hg-committed/logghsax_refsource_MISCWEB
- www.mercurial-scm.org/repo/hg/rev/1acfc35d478cghsax_refsource_MISCWEB
- www.mercurial-scm.org/wiki/WhatsNewghsax_refsource_MISCWEB
News mentions
0No linked articles in our index yet.