Skip to content

Commit 56af25c

Browse files
committed
exif: Fix possible memory leak when tag is empty
When `!value_ptr` is handled, memory is allocated at line 3314. At later exit paths, `outside` (pointing to `value_ptr`) is freed, but not when exiting via the `REQUIRE_NON_EMPTY` macro. Closes phpGH-20169.
1 parent ff3a12b commit 56af25c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Partially fixed bug GH-16317 (DOM classes do not allow
1313
__debugInfo() overrides to work). (nielsdos)
1414

15+
- Exif:
16+
. Fix possible memory leak when tag is empty. (nielsdos)
17+
1518
- FPM:
1619
. Fixed bug GH-19974 (fpm_status_export_to_zval segfault for parallel
1720
execution). (Jakub Zelenka, txuna)

ext/exif/exif.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,6 +3253,7 @@ static bool exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * val
32533253

32543254
#define REQUIRE_NON_EMPTY() do { \
32553255
if (byte_count == 0) { \
3256+
EFREE_IF(outside); \
32563257
exif_error_docref("exif_read_data#error_ifd" EXIFERR_CC, ImageInfo, E_WARNING, "Process tag(x%04X=%s): Cannot be empty", tag, exif_get_tagname_debug(tag, tag_table)); \
32573258
return false; \
32583259
} \

0 commit comments

Comments
 (0)