diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 8f01652bb26..7dffb30490a 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -220,7 +220,7 @@ ZEND_GET_MODULE(exif) * is read or until there is no more data available to read. */ static ssize_t exif_read_from_stream_file_looped(php_stream *stream, char *buf, size_t count) { - ssize_t total_read = 0; + size_t total_read = 0; while (total_read < count) { ssize_t ret = php_stream_read(stream, buf + total_read, count - total_read); if (ret == -1) { @@ -2185,17 +2185,13 @@ static image_info_data *exif_alloc_image_info_data(image_info_list *info_list) { /* {{{ exif_iif_add_value Add a value to image_info */ -static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, int length, void* value, size_t value_len, int motorola_intel) +static void exif_iif_add_value(image_info_type *image_info, int section_index, char *name, int tag, int format, size_t length, void* value, size_t value_len, int motorola_intel) { size_t idex; void *vptr, *vptr_end; image_info_value *info_value; image_info_data *info_data; - if (length < 0) { - return; - } - info_data = exif_alloc_image_info_data(&image_info->info_list[section_index]); memset(info_data, 0, sizeof(image_info_data)); info_data->tag = tag; @@ -2211,7 +2207,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c value = NULL; } if (value) { - length = (int)zend_strnlen(value, length); + length = zend_strnlen(value, length); info_value->s = estrndup(value, length); info_data->length = length; } else { @@ -2242,7 +2238,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c } if (value) { if (tag == TAG_MAKER_NOTE) { - length = (int) zend_strnlen(value, length); + length = zend_strnlen(value, length); } /* do not recompute length here */ @@ -2264,14 +2260,14 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c case TAG_FMT_DOUBLE: if (length==0) { break; - } else + } if (length>1) { info_value->list = safe_emalloc(length, sizeof(image_info_value), 0); } else { info_value = &info_data->value; } vptr_end = (char *) value + value_len; - for (idex=0,vptr=value; idex<(size_t)length; idex++,vptr=(char *) vptr + php_tiff_bytes_per_format[format]) { + for (idex=0,vptr=value; idexmotorola_intel); + exif_iif_add_value(image_info, section_index, name, tag, format, length, value, value_len, image_info->motorola_intel); } /* }}} */