[SCM] exiv2 packaging branch, master, updated. debian/0.25-3.1-3734-gdcbc29a
Maximiliano Curia
maxy at moszumanska.debian.org
Thu Jul 13 17:39:59 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/exiv2.git;a=commitdiff;h=fcd7b2c
The following commit has been merged in the master branch:
commit fcd7b2ca4535f018bc6f6d351b21caca2fcfd26c
Author: Andreas Huggel <ahuggel at gmx.net>
Date: Sun Oct 19 15:05:53 2008 +0000
Fixed test whether data area is outside of the data buffer (partially tested).
---
src/actions.cpp | 17 ++++++++++++-----
src/exif.cpp | 1 +
src/tiffcomposite.cpp | 40 ++++++++++++++++++++++------------------
3 files changed, 35 insertions(+), 23 deletions(-)
diff --git a/src/actions.cpp b/src/actions.cpp
index 2292fb4..50f9085 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -561,8 +561,13 @@ namespace Action {
}
else {
Exiv2::DataBuf buf = exifThumb.copy();
- std::cout << exifThumb.mimeType() << ", "
- << buf.size_ << " " << _("Bytes");
+ if (buf.size_ == 0) {
+ std::cout << _("None");
+ }
+ else {
+ std::cout << exifThumb.mimeType() << ", "
+ << buf.size_ << " " << _("Bytes");
+ }
}
std::cout << std::endl;
@@ -1084,9 +1089,11 @@ namespace Action {
if (dontOverwrite(thumbPath)) return 0;
if (Params::instance().verbose_) {
Exiv2::DataBuf buf = exifThumb.copy();
- std::cout << _("Writing thumbnail") << " (" << exifThumb.mimeType() << ", "
- << buf.size_ << " " << _("Bytes") << ") " << _("to file") << " "
- << thumbPath << std::endl;
+ if (buf.size_ != 0) {
+ std::cout << _("Writing thumbnail") << " (" << exifThumb.mimeType() << ", "
+ << buf.size_ << " " << _("Bytes") << ") " << _("to file") << " "
+ << thumbPath << std::endl;
+ }
}
rc = exifThumb.writeFile(thumb);
if (rc == 0) {
diff --git a/src/exif.cpp b/src/exif.cpp
index a3738f1..3c78fc2 100644
--- a/src/exif.cpp
+++ b/src/exif.cpp
@@ -282,6 +282,7 @@ namespace Exiv2 {
if (thumbnail.get() == 0) return 0;
std::string name = path + thumbnail->extension();
DataBuf buf(thumbnail->copy(exifData_));
+ if (buf.size_ == 0) return 0;
return Exiv2::writeFile(buf, name);
}
diff --git a/src/tiffcomposite.cpp b/src/tiffcomposite.cpp
index 27f7799..dcd6eec 100644
--- a/src/tiffcomposite.cpp
+++ b/src/tiffcomposite.cpp
@@ -285,32 +285,34 @@ namespace Exiv2 {
#endif
return;
}
- long size = 0;
- for (long i = 0; i < pSize->count(); ++i) {
- size += pSize->toLong(i);
+ uint32_t size = 0;
+ for (int i = 0; i < pSize->count(); ++i) {
+ size += static_cast<uint32_t>(pSize->toLong(i));
}
- long offset = pValue()->toLong(0);
+ uint32_t offset = static_cast<uint32_t>(pValue()->toLong(0));
// Todo: Remove limitation of JPEG writer: strips must be contiguous
// Until then we check: last offset + last size - first offset == size?
- if ( pValue()->toLong(pValue()->count()-1)
- + pSize->toLong(pSize->count()-1)
+ if ( static_cast<uint32_t>(pValue()->toLong(pValue()->count()-1))
+ + static_cast<uint32_t>(pSize->toLong(pSize->count()-1))
- offset != size) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Warning: "
<< "Directory " << tiffGroupName(group())
<< ", entry 0x" << std::setw(4)
<< std::setfill('0') << std::hex << tag()
- << " Data area is not contiguous, ignoring it.
";
+ << ": Data area is not contiguous, ignoring it.
";
#endif
return;
}
- if (baseOffset + offset + size > sizeData) {
+ if ( offset > sizeData
+ || size > sizeData
+ || baseOffset + offset > sizeData - size) {
#ifndef SUPPRESS_WARNINGS
std::cerr << "Warning: "
<< "Directory " << tiffGroupName(group())
<< ", entry 0x" << std::setw(4)
<< std::setfill('0') << std::hex << tag()
- << " Data area exceeds data buffer, ignoring it.
";
+ << ": Data area exceeds data buffer, ignoring it.
";
#endif
return;
}
@@ -339,23 +341,25 @@ namespace Exiv2 {
return;
}
for (int i = 0; i < pValue()->count(); ++i) {
- const byte* pStrip = pData + baseOffset + pValue()->toLong(i);
- const uint32_t stripSize = static_cast<uint32_t>(pSize->toLong(i));
- if ( stripSize > 0
- && pData + sizeData > pStrip
- && static_cast<uint32_t>(pData + sizeData - pStrip) >= stripSize) {
- strips_.push_back(std::make_pair(pStrip, stripSize));
- }
+ const uint32_t offset = static_cast<uint32_t>(pValue()->toLong(i));
+ const byte* pStrip = pData + baseOffset + offset;
+ const uint32_t size = static_cast<uint32_t>(pSize->toLong(i));
+
+ if ( offset > sizeData
+ || size > sizeData
+ || baseOffset + offset > sizeData - size) {
#ifndef SUPPRESS_WARNINGS
- else {
std::cerr << "Warning: "
<< "Directory " << tiffGroupName(group())
<< ", entry 0x" << std::setw(4)
<< std::setfill('0') << std::hex << tag()
<< ": Strip " << std::dec << i
<< " is outside of the data area; ignored.
";
- }
#endif
+ }
+ else if (size != 0) {
+ strips_.push_back(std::make_pair(pStrip, size));
+ }
}
} // TiffImageEntry::setStrips
--
exiv2 packaging
More information about the pkg-kde-commits
mailing list