static const char * EXIF_ERROR_FILEEOF = "Unexpected end of file reached";
static const char * EXIF_ERROR_CORRUPT = "File structure corrupted";
static const char * EXIF_ERROR_THUMBEOF = "Thumbnail goes IFD boundary or end of file reached";
+static const char * EXIF_ERROR_FSREALLOC = "Illegal reallocating of undefined file section";
#define EXIF_ERRLOG_FILEEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FILEEOF);
#define EXIF_ERRLOG_CORRUPT php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_CORRUPT);
#define EXIF_ERRLOG_THUMBEOF php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_THUMBEOF);
+#define EXIF_ERRLOG_FSREALLOC php_error_docref(NULL TSRMLS_CC, E_WARNING, EXIF_ERROR_FSREALLOC);
/* }}} */
/* {{{ format description defines
{
void *tmp;
- if (size <= 0 || section_index >= ImageInfo->file.count) {
+ if (section_index >= ImageInfo->file.count) {
+ EXIF_ERRLOG_FSREALLOC
+ return -1;
+ }
+ tmp = erealloc(ImageInfo->file.list[section_index].data, size);
+ if (size == 0 || section_index >= ImageInfo->file.count) {
return -1;
}
tmp = erealloc(ImageInfo->file.list[section_index].data, size);
if (value) {
length = php_strnlen(value, length);
if (PG(magic_quotes_runtime)) {
- info_data->value.s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
+ info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
} else {
info_value->s = estrndup(value, length);
}
if (value) {
/* do not recompute length here */
if (PG(magic_quotes_runtime)) {
- info_data->value.s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
+ info_value->s = php_addslashes(value, length, &length, 0 TSRMLS_CC);
} else {
info_value->s = estrndup(value, length);
}
break;
} else
if (length>1) {
- info_data->value.list = emalloc(length*sizeof(image_info_value));
+ info_value->list = emalloc(length*sizeof(image_info_value));
} else {
info_value = &info_data->value;
}
/* When there are any characters after the first NUL */
ImageInfo->CopyrightPhotographer = estrdup(value_ptr);
ImageInfo->CopyrightEditor = estrdup(value_ptr+length+1);
- ImageInfo->Copyright = emalloc(strlen(value_ptr)+strlen(value_ptr+length+1)+3);
-
- sprintf(ImageInfo->Copyright, "%s, %s", value_ptr, value_ptr+length+1);
+ spprintf(&ImageInfo->Copyright, 0, "%s, %s", value_ptr, value_ptr+length+1);
/* format = TAG_FMT_UNDEFINED; this musn't be ASCII */
/* but we are not supposed to change this */
/* keep in mind that image_info does not store editor value */