afe0b4
diff -urNp old/src/libjasper/jp2/jp2_enc.c new/src/libjasper/jp2/jp2_enc.c
afe0b4
--- old/src/libjasper/jp2/jp2_enc.c	2018-06-21 09:46:45.090301777 +0200
afe0b4
+++ new/src/libjasper/jp2/jp2_enc.c	2018-06-21 10:18:17.602305787 +0200
afe0b4
@@ -115,6 +115,11 @@ int sgnd;
afe0b4
 	iccstream = 0;
afe0b4
 	iccprof = 0;
afe0b4
 
afe0b4
+	if (jas_image_numcmpts(image) < 1) {
afe0b4
+	//	jas_eprintf("image must have at least one component\n");
afe0b4
+		goto error;
afe0b4
+	}
afe0b4
+
afe0b4
 	allcmptssame = 1;
afe0b4
 	sgnd = jas_image_cmptsgnd(image, 0);
afe0b4
 	prec = jas_image_cmptprec(image, 0);