Blob Blame History Raw
Backport of the upstream commit:

From ba2b9d000660313af7b692542afbd374c5685865 Mon Sep 17 00:00:00 2001
From: Michael Adams <mdadams@ece.uvic.ca>
Date: Tue, 25 Oct 2016 16:18:51 -0700
Subject: [PATCH] Ensure that not all tiles lie outside the image area.

diff -pruN jasper-1.900.1.orig/src/libjasper/jpc/jpc_cs.c jasper-1.900.1/src/libjasper/jpc/jpc_cs.c
--- jasper-1.900.1.orig/src/libjasper/jpc/jpc_cs.c	2017-03-29 22:24:57.000000000 +0200
+++ jasper-1.900.1/src/libjasper/jpc/jpc_cs.c	2017-03-29 22:25:48.000000000 +0200
@@ -502,6 +502,10 @@ static int jpc_siz_getparms(jpc_ms_t *ms
 	  !siz->tileheight || !siz->numcomps) {
 		return -1;
 	}
+	if (siz->tilexoff >= siz->width || siz->tileyoff >= siz->height) {
+		jas_eprintf("all tiles are outside the image area\n");
+		return -1;
+	}
 	if (!(siz->comps = jas_alloc2(siz->numcomps, sizeof(jpc_sizcomp_t)))) {
 		return -1;
 	}