Skip to content

Commit 7647ea3

Browse files
committed
workaround for gcc compiler bug (#1421)
1 parent 803b8f5 commit 7647ea3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libheif/file.cc

+4-2
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,10 @@ Error HeifFile::set_item_data(const std::shared_ptr<Box_infe>& item, const uint8
10241024
else {
10251025
// uncompressed data, plain copy
10261026

1027-
data_array.resize(size);
1028-
memcpy(data_array.data(), data, size);
1027+
if (size > 0) { // Note: this 'if' is not necessary, but a workaround to a compiler bug (https://github.com/strukturag/libheif/issues/1421)
1028+
data_array.resize(size);
1029+
memcpy(data_array.data(), data, size);
1030+
}
10291031
}
10301032

10311033
// copy the data into the file, store the pointer to it in an iloc box entry

0 commit comments

Comments
 (0)