shithub: jp2

Download patch

ref: de5fb20b98c830cf38e08058c4df874c9ab6f816
parent: 5323bf5d517d433e45291c1e78292e9cf3e1ac10
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Nov 24 07:33:08 EST 2020

fail on unknown color space

--- a/jp2.c
+++ b/jp2.c
@@ -49,6 +49,10 @@
 		goto error;
 	}
 	jas_stream_close(s);
+	if(jas_clrspc_isunknown(im->clrspc_)){
+		werrstr("unknown color space");
+		goto error;
+	}
 	if((im = jas_image_chclrspc(im, cp, JAS_CMXFORM_INTENT_PER)) == nil){
 		werrstr("failed to change color space");
 		goto error;
@@ -64,7 +68,7 @@
 		goto error;
 	}
 
-	for(i = 0; i < 3; i++){
+	for(i = 0; i < nelem(comps); i++){
 		if((c = jas_image_getcmptbytype(im, comps[i])) < 0){
 			werrstr("failed to get component R");
 			goto error;