com php-src: We need to check for the length here too, or we crash and no one likes that! :(: ext/exif/exif.c
| From: | Kalle Sommer Nielsen | Date: | Wed, 12 Jul 2017 04:11:14 +0000 |
| Subject: | com php-src: We need to check for the length here too, or we crash and no one likes that! :(: ext/exif/exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98524@lists.php.net to get a copy of this message | ||
Commit: 363bb03b7ece6abc9281097a004bd1625f2879f7
Author: Kalle Sommer Nielsen <kalle@php.net> Wed, 12 Jul 2017 06:11:14 +0200
Parents: 969eb8345b5b6dbc30b974940ef849541a963e8b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=363bb03b7ece6abc9281097a004bd1625f2879f7
Log:
We need to check for the length here too, or we crash and no one likes that! :(
Changed paths:
M ext/exif/exif.c
Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index b83b506..2f07198 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -4312,6 +4312,8 @@ static int exif_read_from_stream(image_info_type *ImageInfo, php_stream
*stream,
int ret;
zend_stat_t st;
+ php_printf("exif_read_from_stream");
+
/* Start with an empty image information structure. */
memset(ImageInfo, 0, sizeof(*ImageInfo));
@@ -4375,6 +4377,8 @@ static int exif_read_from_file(image_info_type *ImageInfo, char *FileName, int
r
int ret;
php_stream *stream;
+ php_printf("exif_read_from_file");
+
stream = php_stream_open_wrapper(FileName, "rb", STREAM_MUST_SEEK | IGNORE_PATH, NULL);
if (!stream) {
@@ -4454,6 +4458,12 @@ PHP_FUNCTION(exif_read_data)
} else {
convert_to_string(stream);
+ if (!Z_STRLEN_P(stream)) {
+ exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_WARNING, "Filename cannot be
empty");
+
+ RETURN_FALSE;
+ }
+
ret = exif_read_from_file(&ImageInfo, Z_STRVAL_P(stream), read_thumbnail, read_all);
}
@@ -4618,6 +4628,12 @@ PHP_FUNCTION(exif_thumbnail)
} else {
convert_to_string(stream);
+ if (!Z_STRLEN_P(stream)) {
+ exif_error_docref(NULL EXIFERR_CC, &ImageInfo, E_WARNING, "Filename cannot be
empty");
+
+ RETURN_FALSE;
+ }
+
ret = exif_read_from_file(&ImageInfo, Z_STRVAL_P(stream), 1, 0);
}