summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmin Truta <ctruta@gmail.com>2019-02-03 22:40:56 -0500
committerCosmin Truta <ctruta@gmail.com>2019-02-03 22:40:56 -0500
commit9c0d5c77bf5bf2d7c1e11f388de40a70e0191550 (patch)
tree72e2e0c455f684527aae176a5886ed49e8609020
parent8439534daa1d3a5705ba92e653eda9251246dd61 (diff)
downloadlibpng-9c0d5c77bf5bf2d7c1e11f388de40a70e0191550.tar.gz
Call png_image_free_function without guarding it with png_safe_execute
png_image_free_function (or any other destructor) should never fail. Destructors need not and must not be executed under png_safe_execute. Reference: CVE-2019-7317, use-after-free in png_image_free
-rw-r--r--png.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/png.c b/png.c
index 9d9926f63..efd1aecfb 100644
--- a/png.c
+++ b/png.c
@@ -4588,8 +4588,7 @@ png_image_free(png_imagep image)
if (image != NULL && image->opaque != NULL &&
image->opaque->error_buf == NULL)
{
- /* Ignore errors here: */
- (void)png_safe_execute(image, png_image_free_function, image);
+ png_image_free_function(image);
image->opaque = NULL;
}
}