CVE Vulnerabilities

CVE-2021-40145

Double Free

Published: Aug 26, 2021 | Modified: Jun 17, 2026
CVSS 3.x
7.5
HIGH
Source:
NVD
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CVSS 2.x
5 MEDIUM
AV:N/AC:L/Au:N/C:N/I:N/A:P
RedHat/V2
RedHat/V3
Ubuntu
MEDIUM

gdImageGd2Ptr in gd_gd2.c in the GD Graphics Library (aka LibGD) through 2.3.2 has a double free. NOTE: the vendors position is The GD2 image format is a proprietary image format of libgd. It has to be regarded as being obsolete, and should only be used for development and testing purposes.

Weakness

The product calls free() twice on the same memory address.

Affected Software

NameVendorStart VersionEnd Version
LibgdLibgd*2.3.2 (including)
Libgd2Ubuntubionic*
Libgd2Ubuntudevel*
Libgd2Ubuntuesm-infra-legacy/trusty*
Libgd2Ubuntuesm-infra-legacy/xenial*
Libgd2Ubuntuesm-infra/bionic*
Libgd2Ubuntuesm-infra/focal*
Libgd2Ubuntuesm-infra/xenial*
Libgd2Ubuntufocal*
Libgd2Ubuntuhirsute*
Libgd2Ubuntuimpish*
Libgd2Ubuntujammy*
Libgd2Ubuntutrusty*
Libgd2Ubuntutrusty/esm*
Libgd2Ubuntuxenial*

Potential Mitigations

References