mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
3rdparty(libpng): fix leak in png_handle_eXIf
oss-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13314
ported commit: a142b7a543
This commit is contained in:
parent
43467a2ac7
commit
419a6d51b3
17
3rdparty/libpng/patches/20190528-fix-leak-png_handle_exif.diff
vendored
Normal file
17
3rdparty/libpng/patches/20190528-fix-leak-png_handle_exif.diff
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
diff --git a/3rdparty/libpng/pngrutil.c b/3rdparty/libpng/pngrutil.c
|
||||
index d5fa08c397..4db3de990b 100644
|
||||
--- a/3rdparty/libpng/pngrutil.c
|
||||
+++ b/3rdparty/libpng/pngrutil.c
|
||||
@@ -2087,10 +2087,8 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
}
|
||||
}
|
||||
|
||||
- if (png_crc_finish(png_ptr, 0) != 0)
|
||||
- return;
|
||||
-
|
||||
- png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
||||
+ if (png_crc_finish(png_ptr, 0) == 0)
|
||||
+ png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
||||
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
6
3rdparty/libpng/pngrutil.c
vendored
6
3rdparty/libpng/pngrutil.c
vendored
@ -2087,10 +2087,8 @@ png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
}
|
||||
}
|
||||
|
||||
if (png_crc_finish(png_ptr, 0) != 0)
|
||||
return;
|
||||
|
||||
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
||||
if (png_crc_finish(png_ptr, 0) == 0)
|
||||
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
||||
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user