Skip to content

Commit 235bf52

Browse files
authored
Merge pull request #2181 from Exiv2/main_issue2179
[main] Fix integer overflow #2179
2 parents 6e9eca4 + a505d6f commit 235bf52

File tree

5 files changed

+231
-69
lines changed

5 files changed

+231
-69
lines changed

include/exiv2/jpgimage.hpp

Lines changed: 37 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,77 +18,58 @@ namespace Exiv2 {
1818
// *****************************************************************************
1919
// class definitions
2020

21-
/*!
22-
@brief Helper class, has methods to deal with %Photoshop "Information
23-
Resource Blocks" (IRBs).
24-
*/
21+
/// @brief Helper class, has methods to deal with %Photoshop "Information Resource Blocks" (IRBs).
2522
struct EXIV2API Photoshop {
2623
// Todo: Public for now
2724
static constexpr std::array irbId_{"8BIM", "AgHg", "DCSR", "PHUT"}; //!< %Photoshop IRB markers
2825
static constexpr auto ps3Id_ = "Photoshop 3.0\0"; //!< %Photoshop marker
29-
static constexpr auto bimId_ = "8BIM"; //!< %Photoshop IRB marker (deprecated)
3026
static constexpr uint16_t iptc_ = 0x0404; //!< %Photoshop IPTC marker
3127
static constexpr uint16_t preview_ = 0x040c; //!< %Photoshop preview marker
3228

33-
/*!
34-
@brief Checks an IRB
35-
36-
@param pPsData Existing IRB buffer
37-
@param sizePsData Size of the IRB buffer
38-
@return true if the IRB marker is known and the buffer is big enough to check this;<BR>
39-
false otherwise
40-
*/
41-
static bool isIrb(const byte* pPsData, size_t sizePsData);
42-
/*!
43-
@brief Validates all IRBs
44-
45-
@param pPsData Existing IRB buffer
46-
@param sizePsData Size of the IRB buffer, may be 0
47-
@return true if all IRBs are valid;<BR>
48-
false otherwise
49-
*/
29+
/// @brief Checks an IRB
30+
/// @param pPsData Existing IRB buffer. It is expected to be of size 4.
31+
/// @return true if the IRB marker is known
32+
/// @todo This should be an implementation detail and not exposed in the API. An attacker could try to pass
33+
/// a smaller buffer or null pointer.
34+
static bool isIrb(const byte* pPsData);
35+
36+
/// @brief Validates all IRBs
37+
/// @param pPsData Existing IRB buffer
38+
/// @param sizePsData Size of the IRB buffer, may be 0
39+
/// @return true if all IRBs are valid;<BR> false otherwise
5040
static bool valid(const byte* pPsData, size_t sizePsData);
51-
/*!
52-
@brief Locates the data for a %Photoshop tag in a %Photoshop formated memory
53-
buffer. Operates on raw data to simplify reuse.
54-
@param pPsData Pointer to buffer containing entire payload of
55-
%Photoshop formated data, e.g., from APP13 Jpeg segment.
56-
@param sizePsData Size in bytes of pPsData.
57-
@param psTag %Tag number of the block to look for.
58-
@param record Output value that is set to the start of the
59-
data block within pPsData (may not be null).
60-
@param sizeHdr Output value that is set to the size of the header
61-
within the data block pointed to by record (may not be null).
62-
@param sizeData Output value that is set to the size of the actual
63-
data within the data block pointed to by record (may not be null).
64-
@return 0 if successful;<BR>
65-
3 if no data for psTag was found in pPsData;<BR>
66-
-2 if the pPsData buffer does not contain valid data.
67-
*/
41+
42+
/// @brief Locates the data for a %Photoshop tag in a %Photoshop formated memory buffer.
43+
/// Operates on raw data to simplify reuse.
44+
/// @param pPsData Pointer to buffer containing entire payload of %Photoshop formated data (from APP13 Jpeg segment)
45+
/// @param sizePsData Size in bytes of pPsData.
46+
/// @param psTag %Tag number of the block to look for.
47+
/// @param record Output value that is set to the start of the data block within pPsData (may not be null).
48+
/// @param sizeHdr Output value that is set to the size of the header within the data block pointed to by record
49+
/// (may not be null).
50+
/// @param sizeData Output value that is set to the size of the actual data within the data block pointed to by record
51+
/// (may not be null).
52+
/// @return 0 if successful;<BR>
53+
/// 3 if no data for psTag was found in pPsData;<BR>
54+
/// -2 if the pPsData buffer does not contain valid data.
6855
static int locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag, const byte** record,
6956
uint32_t* const sizeHdr, uint32_t* const sizeData);
70-
/*!
71-
@brief Forwards to locateIrb() with \em psTag = \em iptc_
72-
*/
57+
58+
/// @brief Forwards to locateIrb() with \em psTag = \em iptc_
7359
static int locateIptcIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* const sizeHdr,
7460
uint32_t* const sizeData);
75-
/*!
76-
@brief Forwards to locatePreviewIrb() with \em psTag = \em preview_
77-
*/
61+
62+
/// @brief Forwards to locatePreviewIrb() with \em psTag = \em preview_
7863
static int locatePreviewIrb(const byte* pPsData, size_t sizePsData, const byte** record, uint32_t* const sizeHdr,
7964
uint32_t* const sizeData);
80-
/*!
81-
@brief Set the new IPTC IRB, keeps existing IRBs but removes the
82-
IPTC block if there is no new IPTC data to write.
83-
84-
@param pPsData Existing IRB buffer
85-
@param sizePsData Size of the IRB buffer, may be 0
86-
@param iptcData Iptc data to embed, may be empty
87-
@return A data buffer containing the new IRB buffer, may have 0 size
88-
*/
89-
static DataBuf setIptcIrb(const byte* pPsData, size_t sizePsData, const IptcData& iptcData);
9065

91-
}; // class Photoshop
66+
/// @brief Set the new IPTC IRB, keeps existing IRBs but removes the IPTC block if there is no new IPTC data to write.
67+
/// @param pPsData Existing IRB buffer
68+
/// @param sizePsData Size of the IRB buffer, may be 0
69+
/// @param iptcData Iptc data to embed, may be empty
70+
/// @return A data buffer containing the new IRB buffer, may have 0 size
71+
static DataBuf setIptcIrb(const byte* pPsData, size_t sizePsData, const IptcData& iptcData);
72+
};
9273

9374
/*!
9475
@brief Abstract helper base class to access JPEG images.

src/jpgimage.cpp

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ static inline bool inRange2(int value, int lo1, int hi1, int lo2, int hi2) {
3535
return inRange(lo1, value, hi1) || inRange(lo2, value, hi2);
3636
}
3737

38-
bool Photoshop::isIrb(const byte* pPsData, size_t sizePsData) {
39-
if (sizePsData < 4)
38+
bool Photoshop::isIrb(const byte* pPsData) {
39+
if (pPsData == nullptr) {
4040
return false;
41+
}
42+
/// \todo check if direct array comparison is faster than a call to memcmp
4143
return std::any_of(irbId_.begin(), irbId_.end(), [pPsData](auto id) { return memcmp(pPsData, id, 4) == 0; });
4244
}
4345

@@ -69,7 +71,7 @@ int Photoshop::locateIrb(const byte* pPsData, size_t sizePsData, uint16_t psTag,
6971
std::cerr << "Photoshop::locateIrb: ";
7072
#endif
7173
// Data should follow Photoshop format, if not exit
72-
while (position <= sizePsData - 12 && isIrb(pPsData + position, 4)) {
74+
while (position <= (sizePsData - 12) && isIrb(pPsData + position)) {
7375
const byte* hrd = pPsData + position;
7476
position += 4;
7577
uint16_t type = getUShort(pPsData + position, bigEndian);
@@ -150,16 +152,17 @@ DataBuf Photoshop::setIptcIrb(const byte* pPsData, size_t sizePsData, const Iptc
150152
uint32_t sizeIptc = 0;
151153
uint32_t sizeHdr = 0;
152154
DataBuf rc;
153-
// Safe to call with zero psData.size_
154155
if (0 > Photoshop::locateIptcIrb(pPsData, sizePsData, &record, &sizeHdr, &sizeIptc)) {
155156
return rc;
156157
}
158+
157159
Blob psBlob;
158160
const auto sizeFront = static_cast<size_t>(record - pPsData);
159161
// Write data before old record.
160162
if (sizePsData > 0 && sizeFront > 0) {
161163
append(psBlob, pPsData, sizeFront);
162164
}
165+
163166
// Write new iptc record if we have it
164167
DataBuf rawIptc = IptcParser::encode(iptcData);
165168
if (!rawIptc.empty()) {
@@ -175,21 +178,24 @@ DataBuf Photoshop::setIptcIrb(const byte* pPsData, size_t sizePsData, const Iptc
175178
if (rawIptc.size() & 1)
176179
psBlob.push_back(0x00);
177180
}
178-
// Write existing stuff after record,
179-
// skip the current and all remaining IPTC blocks
181+
182+
// Write existing stuff after record, skip the current and all remaining IPTC blocks
180183
size_t pos = sizeFront;
181-
while (0 == Photoshop::locateIptcIrb(pPsData + pos, sizePsData - pos, &record, &sizeHdr, &sizeIptc)) {
184+
long nextSizeData = Safe::add<long>(static_cast<long>(sizePsData), -static_cast<long>(pos));
185+
enforce(nextSizeData >= 0, ErrorCode::kerCorruptedMetadata);
186+
while (0 == Photoshop::locateIptcIrb(pPsData + pos, nextSizeData, &record, &sizeHdr, &sizeIptc)) {
182187
const auto newPos = static_cast<size_t>(record - pPsData);
183-
// Copy data up to the IPTC IRB
184-
if (newPos > pos) {
188+
if (newPos > pos) { // Copy data up to the IPTC IRB
185189
append(psBlob, pPsData + pos, newPos - pos);
186190
}
187-
// Skip the IPTC IRB
188-
pos = newPos + sizeHdr + sizeIptc + (sizeIptc & 1);
191+
pos = newPos + sizeHdr + sizeIptc + (sizeIptc & 1); // Skip the IPTC IRB
192+
nextSizeData = Safe::add<long>(static_cast<long>(sizePsData), -static_cast<long>(pos));
193+
enforce(nextSizeData >= 0, ErrorCode::kerCorruptedMetadata);
189194
}
190195
if (pos < sizePsData) {
191196
append(psBlob, pPsData + pos, sizePsData - pos);
192197
}
198+
193199
// Data is rounded to be even
194200
if (!psBlob.empty())
195201
rc = DataBuf(&psBlob[0], psBlob.size());

src/psdimage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void PsdImage::readMetadata() {
175175
throw Error(ErrorCode::kerNotAnImage, "Photoshop");
176176
}
177177

178-
if (!Photoshop::isIrb(buf, 4)) {
178+
if (!Photoshop::isIrb(buf)) {
179179
break; // bad resource type
180180
}
181181
uint16_t resourceId = getUShort(buf + 4, bigEndian);
@@ -413,7 +413,7 @@ void PsdImage::doWriteMetadata(BasicIo& outIo) {
413413
// read resource type and ID
414414
uint32_t resourceType = getULong(buf, bigEndian);
415415

416-
if (!Photoshop::isIrb(buf, 4)) {
416+
if (!Photoshop::isIrb(buf)) {
417417
throw Error(ErrorCode::kerNotAnImage, "Photoshop"); // bad resource type
418418
}
419419
uint16_t resourceId = getUShort(buf + 4, bigEndian);

unitTests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_executable(unit_tests
1818
test_jp2image_int.cpp
1919
test_IptcKey.cpp
2020
test_LangAltValueRead.cpp
21+
test_Photoshop.cpp
2122
test_pngimage.cpp
2223
test_safe_op.cpp
2324
test_slice.cpp

unitTests/test_Photoshop.cpp

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
#include <exiv2/jpgimage.hpp>
4+
5+
#include <gtest/gtest.h>
6+
7+
using namespace Exiv2;
8+
9+
namespace {
10+
constexpr std::array validMarkers{"8BIM", "AgHg", "DCSR", "PHUT"};
11+
}
12+
13+
TEST(Photoshop_isIrb, returnsTrueWithValidMarkers) {
14+
for (const auto& marker : validMarkers) {
15+
ASSERT_TRUE(Photoshop::isIrb(reinterpret_cast<const byte*>(marker)));
16+
}
17+
}
18+
19+
TEST(Photoshop_isIrb, returnsFalseWithInvalidMarkers) {
20+
ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast<const byte*>("7BIM")));
21+
ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast<const byte*>("AGHg")));
22+
ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast<const byte*>("dcsr")));
23+
ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast<const byte*>("LUIS")));
24+
}
25+
26+
TEST(Photoshop_isIrb, returnsFalseWithNullPointer) {
27+
ASSERT_FALSE(Photoshop::isIrb(nullptr));
28+
}
29+
30+
/// \note probably this is not safe and we need to remove it
31+
TEST(Photoshop_isIrb, returnsFalseWithShorterMarker) {
32+
ASSERT_FALSE(Photoshop::isIrb(reinterpret_cast<const byte*>("8BI")));
33+
}
34+
35+
TEST(Photoshop_locateIrb, returnsMinus2withInvalidPhotoshopIRB) {
36+
const std::string data{"8BIMlalalalalalala"};
37+
const Exiv2::byte* record;
38+
uint32_t sizeHdr = 0;
39+
uint32_t sizeData = 0;
40+
ASSERT_EQ(-2, Photoshop::locateIrb(reinterpret_cast<const byte*>(data.c_str()), data.size(), Photoshop::iptc_,
41+
&record, &sizeHdr, &sizeData));
42+
}
43+
44+
TEST(Photoshop_locateIrb, returnsMinus2WithMarkerNotStartingWith8BIM) {
45+
const std::string data{"7BIMlalalalalalalala"};
46+
const Exiv2::byte* record;
47+
uint32_t sizeHdr = 0;
48+
uint32_t sizeData = 0;
49+
ASSERT_EQ(-2, Photoshop::locateIrb(reinterpret_cast<const byte*>(data.c_str()), data.size(), Photoshop::iptc_,
50+
&record, &sizeHdr, &sizeData));
51+
}
52+
53+
TEST(Photoshop_locateIrb, returns3withNotLongEnoughData) {
54+
const std::string data{"8BIMlala"};
55+
const Exiv2::byte* record;
56+
uint32_t sizeHdr = 0;
57+
uint32_t sizeData = 0;
58+
ASSERT_EQ(3, Photoshop::locateIrb(reinterpret_cast<const byte*>(data.c_str()), data.size(), Photoshop::iptc_, &record,
59+
&sizeHdr, &sizeData));
60+
}
61+
62+
TEST(Photoshop_locateIrb, returns0withGoodIptcIrb) {
63+
// Data taken from file test/data/DSC_3079.jpg
64+
// The IPTC marker is 0x04 0x04
65+
const std::array<byte, 68> data{0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01,
66+
0x5a, 0x00, 0x03, 0x1b, 0x25, 0x47, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x04, 0x1c,
67+
0x02, 0x19, 0x00, 0x07, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x00, 0x38, 0x42,
68+
0x49, 0x4d, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x65, 0x16, 0xda,
69+
0x51, 0x3f, 0xfe, 0x5c, 0xbb, 0x52, 0xf3, 0x2e, 0x36, 0x7b, 0x97, 0x3d};
70+
71+
const Exiv2::byte* record;
72+
uint32_t sizeHdr = 0;
73+
uint32_t sizeData = 0;
74+
75+
ASSERT_EQ(0, Photoshop::locateIrb(data.data(), data.size(), Photoshop::iptc_, &record, &sizeHdr, &sizeData));
76+
ASSERT_EQ(12, sizeHdr);
77+
ASSERT_EQ(27, sizeData);
78+
}
79+
80+
TEST(Photoshop_locateIptcIrb, returns0withGoodIptcIrb) {
81+
// Data taken from file test/data/DSC_3079.jpg
82+
// The IPTC marker is 0x04 0x04
83+
const std::array<byte, 68> data{0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01,
84+
0x5a, 0x00, 0x03, 0x1b, 0x25, 0x47, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x04, 0x1c,
85+
0x02, 0x19, 0x00, 0x07, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x00, 0x38, 0x42,
86+
0x49, 0x4d, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x65, 0x16, 0xda,
87+
0x51, 0x3f, 0xfe, 0x5c, 0xbb, 0x52, 0xf3, 0x2e, 0x36, 0x7b, 0x97, 0x3d};
88+
89+
const Exiv2::byte* record;
90+
uint32_t sizeHdr = 0;
91+
uint32_t sizeData = 0;
92+
93+
ASSERT_EQ(0, Photoshop::locateIptcIrb(data.data(), data.size(), &record, &sizeHdr, &sizeData));
94+
ASSERT_EQ(12, sizeHdr);
95+
ASSERT_EQ(27, sizeData);
96+
}
97+
98+
TEST(Photoshop_locateIptcIrb, returns3withoutIptcMarker) {
99+
// Data taken from file test/data/DSC_3079.jpg
100+
// The IPTC marker (0x04 0x04) was manipulated to 0x03 0x04
101+
const std::array<byte, 68> data{0x38, 0x42, 0x49, 0x4d, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01,
102+
0x5a, 0x00, 0x03, 0x1b, 0x25, 0x47, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x04, 0x1c,
103+
0x02, 0x19, 0x00, 0x07, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x00, 0x38, 0x42,
104+
0x49, 0x4d, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x65, 0x16, 0xda,
105+
0x51, 0x3f, 0xfe, 0x5c, 0xbb, 0x52, 0xf3, 0x2e, 0x36, 0x7b, 0x97, 0x3d};
106+
107+
const Exiv2::byte* record;
108+
uint32_t sizeHdr = 0;
109+
uint32_t sizeData = 0;
110+
111+
ASSERT_EQ(3, Photoshop::locateIptcIrb(data.data(), data.size(), &record, &sizeHdr, &sizeData));
112+
}
113+
114+
TEST(Photoshop_locatePreviewIrb, returns0withGoodPreviewIrb) {
115+
// Data taken from file test/data/DSC_3079.jpg
116+
// The IPTC marker is 0x04 0x04 was transformed to a Preview one => (0x04 0x0c)
117+
const std::array<byte, 68> data{0x38, 0x42, 0x49, 0x4d, 0x04, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1c, 0x01,
118+
0x5a, 0x00, 0x03, 0x1b, 0x25, 0x47, 0x1c, 0x02, 0x00, 0x00, 0x02, 0x00, 0x04, 0x1c,
119+
0x02, 0x19, 0x00, 0x07, 0x41, 0x6d, 0x65, 0x72, 0x69, 0x63, 0x61, 0x00, 0x38, 0x42,
120+
0x49, 0x4d, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x3f, 0x65, 0x16, 0xda,
121+
0x51, 0x3f, 0xfe, 0x5c, 0xbb, 0x52, 0xf3, 0x2e, 0x36, 0x7b, 0x97, 0x3d};
122+
123+
const Exiv2::byte* record;
124+
uint32_t sizeHdr = 0;
125+
uint32_t sizeData = 0;
126+
127+
ASSERT_EQ(0, Photoshop::locatePreviewIrb(data.data(), data.size(), &record, &sizeHdr, &sizeData));
128+
ASSERT_EQ(12, sizeHdr);
129+
ASSERT_EQ(27, sizeData);
130+
}
131+
132+
// --------------------------------
133+
134+
TEST(Photoshop_setIptcIrb, withEmptyDataReturnsEmptyBuffer) {
135+
const IptcData iptc;
136+
DataBuf buf = Photoshop::setIptcIrb(nullptr, 0, iptc);
137+
ASSERT_TRUE(buf.empty());
138+
}
139+
140+
TEST(Photoshop_setIptcIrb, detectIntegerOverflow_withDataFromPOC2179) {
141+
const std::array<byte, 141> data{
142+
0x38, 0x42, 0x49, 0x4d, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x04,
143+
0x00, 0x20, 0x00, 0x00, 0x00, 0x75, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0x20, 0x20,
144+
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xff, 0x20, 0x20, 0x20,
145+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 0x20, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
146+
0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
147+
0xff, 0xff, 0x20, 0x20, 0xff, 0x20, 0xff, 0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
148+
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xff, 0x20, 0x20, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
149+
0xff, 0xff, 0xff, 0x20, 0xff, 0xff, 0xff, 0xff, 0x20, 0xff, 0xff, 0x20, 0xff, 0xff, 0xff};
150+
151+
const IptcData iptc;
152+
153+
ASSERT_THROW(Photoshop::setIptcIrb(data.data(), data.size(), iptc), Exiv2::Error);
154+
}
155+
156+
TEST(Photoshop_setIptcIrb, returnsEmptyBufferWhenDataDoesNotHave8BIM) {
157+
// First byte replaced from 0x38 to 0x37
158+
const std::array<byte, 181> data{
159+
0x37, 0x42, 0x49, 0x4d, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x38, 0x42, 0x49, 0x4d, 0x04, 0x04, 0x00,
160+
0x20, 0x00, 0x00, 0x00, 0x75, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0x20, 0x20, 0x20, 0x20,
161+
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xff, 0x20, 0x20, 0x20, 0xff, 0xff, 0xff,
162+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 0x20, 0xff, 0x20, 0x20, 0xff, 0xed, 0x00, 0x15, 0x50, 0x68, 0x6f, 0x74,
163+
0x6f, 0x73, 0x68, 0x6f, 0x70, 0x20, 0x33, 0x2e, 0x30, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xed, 0x00, 0x54,
164+
0x50, 0x68, 0x6f, 0x74, 0x6f, 0x73, 0x68, 0x6f, 0x70, 0x20, 0x33, 0x2e, 0x30, 0x00, 0x20, 0x20, 0x20, 0x20, 0xff,
165+
0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0xff, 0x20, 0x20, 0xff, 0x20, 0xff,
166+
0xff, 0xff, 0xff, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff,
167+
0xff, 0x20, 0x20, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x20, 0xff, 0xff, 0xff, 0xff, 0x20,
168+
0xff, 0xff, 0x20, 0xff, 0xff, 0xff, 0xff, 0xd9, 0x0d, 0x0a};
169+
170+
const IptcData iptc;
171+
172+
DataBuf buf = Photoshop::setIptcIrb(data.data(), data.size(), iptc);
173+
ASSERT_TRUE(buf.empty());
174+
}

0 commit comments

Comments
 (0)