summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-12-13 21:22:15 +0100
committerCarl Hetherington <cth@carlh.net>2021-01-17 20:13:22 +0100
commit5382d3e0e587b1882ea39be146bbd9dd5700c3bb (patch)
tree1919f532e8dd0d322f7406a39892b45e54b019e4 /src
parentea454d8c6eabe0dfa3e82b36e5813012cf93395c (diff)
Raise an exception to head off a weird asdcplib error with empty JPEG2000 comments.
Diffstat (limited to 'src')
-rw-r--r--src/j2k.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/j2k.cc b/src/j2k.cc
index 032c7caa..654146ca 100644
--- a/src/j2k.cc
+++ b/src/j2k.cc
@@ -283,6 +283,11 @@ dcp::compress_j2k (shared_ptr<const OpenJPEGImage> xyz, int bandwidth, int frame
throw MiscError ("could not create JPEG2000 encoder");
}
+ if (comment.empty()) {
+ /* asdcplib complains with "Illegal data size" when reading frames encoded with an empty comment */
+ throw MiscError("compress_j2k comment can not be an empty string");
+ }
+
opj_set_error_handler (encoder, compress_error_callback, 0);
/* Set encoding parameters to default values */