summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg/src/Metadata/IPTC.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-01-03 14:34:48 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-01-03 14:34:48 +0000
commiteb680766d56e815086397361b286fd8055fb5377 (patch)
tree7994cdb0d9077f645ba7fd06bdd2cde32cf599d4 /plugins/AdvaImg/src/Metadata/IPTC.cpp
parentec61686c3d96f49eb7f40a4208690a0781d63e29 (diff)
FreeImage updated to 3.15.4
removed not used formats git-svn-id: http://svn.miranda-ng.org/main/trunk@2926 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AdvaImg/src/Metadata/IPTC.cpp')
-rw-r--r--plugins/AdvaImg/src/Metadata/IPTC.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/plugins/AdvaImg/src/Metadata/IPTC.cpp b/plugins/AdvaImg/src/Metadata/IPTC.cpp
index 817beddf98..bde718c986 100644
--- a/plugins/AdvaImg/src/Metadata/IPTC.cpp
+++ b/plugins/AdvaImg/src/Metadata/IPTC.cpp
@@ -41,15 +41,27 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
size_t length = datalen;
BYTE *profile = (BYTE*)dataptr;
+ const char *JPEG_AdobeCM_Tag = "Adobe_CM";
+
std::string Keywords;
std::string SupplementalCategory;
WORD tag_id;
- if (!dataptr || (datalen == 0)) {
+ if(!dataptr || (datalen == 0)) {
return FALSE;
}
+ if(datalen > 8) {
+ if(memcmp(JPEG_AdobeCM_Tag, dataptr, 8) == 0) {
+ // the "Adobe_CM" APP13 segment presumably contains color management information,
+ // but the meaning of the data is currently unknown.
+ // If anyone has an idea about what this means, please let me know.
+ return FALSE;
+ }
+ }
+
+
// create a tag
FITAG *tag = FreeImage_CreateTag();
@@ -59,7 +71,7 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
// find start of the BIM portion of the binary data
size_t offset = 0;
while(offset < length - 1) {
- if ((profile[offset] == 0x1C) && (profile[offset+1] == 0x02))
+ if((profile[offset] == 0x1C) && (profile[offset+1] == 0x02))
break;
offset++;
}
@@ -88,6 +100,11 @@ read_iptc_profile(FIBITMAP *dib, const BYTE *dataptr, unsigned int datalen) {
break;
}
+ if(tagByteCount == 0) {
+ // go to next tag
+ continue;
+ }
+
// process the tag
tag_id = (WORD)(tagType | (directoryType << 8));
@@ -211,7 +228,7 @@ append_iptc_tag(BYTE *profile, unsigned *profile_size, WORD id, DWORD length, co
// calculate the new buffer size
size_t buffer_size = (5 + *profile_size + length) * sizeof(BYTE);
buffer = (BYTE*)malloc(buffer_size);
- if (!buffer)
+ if(!buffer)
return NULL;
// add the header