|
|
|
@ -84,6 +84,9 @@ typedef unsigned char uchar; |
|
|
|
#ifndef safe_emalloc |
|
|
|
# define safe_emalloc(a,b,c) emalloc((a)*(b)+(c)) |
|
|
|
#endif |
|
|
|
#ifndef safe_erealloc |
|
|
|
# define safe_erealloc(p,a,b,c) erealloc(p, (a)*(b)+(c)) |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifndef TRUE |
|
|
|
# define TRUE 1 |
|
|
|
@ -1597,7 +1600,7 @@ static int exif_file_sections_add(image_info_type *ImageInfo, int type, size_t s |
|
|
|
file_section *tmp; |
|
|
|
int count = ImageInfo->file.count; |
|
|
|
|
|
|
|
tmp = erealloc(ImageInfo->file.list, (count+1)*sizeof(file_section)); |
|
|
|
tmp = safe_erealloc(ImageInfo->file.list, (count+1), sizeof(file_section), 0); |
|
|
|
ImageInfo->file.list = tmp; |
|
|
|
ImageInfo->file.list[count].type = 0xFFFF; |
|
|
|
ImageInfo->file.list[count].data = NULL; |
|
|
|
@ -1629,7 +1632,7 @@ static int exif_file_sections_realloc(image_info_type *ImageInfo, int section_in |
|
|
|
EXIF_ERRLOG_FSREALLOC(ImageInfo) |
|
|
|
return -1; |
|
|
|
} |
|
|
|
tmp = erealloc(ImageInfo->file.list[section_index].data, size); |
|
|
|
tmp = safe_erealloc(ImageInfo->file.list[section_index].data, 1, size, 0); |
|
|
|
ImageInfo->file.list[section_index].data = tmp; |
|
|
|
ImageInfo->file.list[section_index].size = size; |
|
|
|
return 0; |
|
|
|
@ -1669,7 +1672,7 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data)); |
|
|
|
list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); |
|
|
|
image_info->info_list[section_index].list = list; |
|
|
|
|
|
|
|
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; |
|
|
|
@ -1807,7 +1810,7 @@ static void exif_iif_add_int(image_info_type *image_info, int section_index, cha |
|
|
|
image_info_data *info_data; |
|
|
|
image_info_data *list; |
|
|
|
|
|
|
|
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data)); |
|
|
|
list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); |
|
|
|
image_info->info_list[section_index].list = list; |
|
|
|
|
|
|
|
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; |
|
|
|
@ -1830,7 +1833,7 @@ static void exif_iif_add_str(image_info_type *image_info, int section_index, cha |
|
|
|
image_info_data *list; |
|
|
|
|
|
|
|
if (value) { |
|
|
|
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data)); |
|
|
|
list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); |
|
|
|
image_info->info_list[section_index].list = list; |
|
|
|
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; |
|
|
|
info_data->tag = TAG_NONE; |
|
|
|
@ -1875,7 +1878,7 @@ static void exif_iif_add_buffer(image_info_type *image_info, int section_index, |
|
|
|
image_info_data *list; |
|
|
|
|
|
|
|
if (value) { |
|
|
|
list = erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1)*sizeof(image_info_data)); |
|
|
|
list = safe_erealloc(image_info->info_list[section_index].list, (image_info->info_list[section_index].count+1), sizeof(image_info_data), 0); |
|
|
|
image_info->info_list[section_index].list = list; |
|
|
|
info_data = &image_info->info_list[section_index].list[image_info->info_list[section_index].count]; |
|
|
|
info_data->tag = TAG_NONE; |
|
|
|
@ -2489,7 +2492,7 @@ static void exif_thumbnail_build(image_info_type *ImageInfo TSRMLS_DC) { |
|
|
|
} |
|
|
|
} |
|
|
|
new_move = new_size; |
|
|
|
new_data = erealloc(ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size+new_size); |
|
|
|
new_data = safe_erealloc(ImageInfo->Thumbnail.data, 1, ImageInfo->Thumbnail.size, new_size); |
|
|
|
ImageInfo->Thumbnail.data = new_data; |
|
|
|
memmove(ImageInfo->Thumbnail.data + new_move, ImageInfo->Thumbnail.data, ImageInfo->Thumbnail.size); |
|
|
|
ImageInfo->Thumbnail.size += new_size; |
|
|
|
@ -2985,7 +2988,7 @@ static int exif_process_IFD_TAG(image_info_type *ImageInfo, char *dir_entry, cha |
|
|
|
case TAG_XP_AUTHOR: |
|
|
|
case TAG_XP_KEYWORDS: |
|
|
|
case TAG_XP_SUBJECT: |
|
|
|
tmp_xp = (xp_field_type*)erealloc(ImageInfo->xp_fields.list, sizeof(xp_field_type)*(ImageInfo->xp_fields.count+1)); |
|
|
|
tmp_xp = (xp_field_type*)safe_erealloc(ImageInfo->xp_fields.list, (ImageInfo->xp_fields.count+1), sizeof(xp_field_type), 0); |
|
|
|
ImageInfo->sections_found |= FOUND_WINXP; |
|
|
|
ImageInfo->xp_fields.list = tmp_xp; |
|
|
|
ImageInfo->xp_fields.count++; |
|
|
|
|